Friday, October 10, 2025
dev@conference.yunohost.org
October
Mon Tue Wed Thu Fri Sat Sun
    1
2
3
4
5
6
7
8
9
10
11
12
13
14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
             

[08:03:45] <Yunohost Git/Infra notifications> [Apps tools error] [List builder] Error while updating silverbullet: Found invalid character in key name: <. Try quoting the key name. (line 10 column 2 char 363)
[08:18:20] <florent[m]> What the …
https://github.com/YunoHost-Apps/silverbullet_ynh/blob/master/manifest.toml
[08:20:11] <florent[m]> Should be fixed (that's a useful notif)
[08:29:24] <tituspijean> Usually when I package and app and I see that error on a json file, I'm assuming the SSO has blocked the page 😅
[11:08:44] <florent[m]> Ergh, I am deeply sorry, I have forgotten how to run the tests for the Yunohost core, and I don't remember where to find documentation for that.
I remember I had to run an incus container (using `ynh-dev`, it's already set up) but forgot the rest.
I would like to run the tests for this file: https://github.com/YunoHost/yunohost/blob/dev/tests/test_app_resources.py
[11:13:10] <florent[m]> I have setup a virtual env, installed the dependencies using `python3 -m pip install -e .` and installed pytest using `pip install pytest`
[11:22:29] <florent[m]> Looks like my main difficulty is for importing moulinette :

```
(env) root@ynh-test-bookworm-unstable:/ynh-dev/yunohost# uv run pytest
warning: `VIRTUAL_ENV=env` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
ImportError while loading conftest '/ynh-dev/yunohost/tests/conftest.py'.
tests/conftest.py:26: in <module>
import moulinette
E ModuleNotFoundError: No module named 'moulinette'
```

(I admit I don't know what I am doing, I should at some point truly learn Python)
[12:12:59] <florent[m]> It looks like you have to run the tests using `./ynh-dev test yunohost/YOUR_TEST_FILE:YOUR_TEST_NAME`.

Quoting:
```
test [PKG] Deploy, update and run tests for some packages
Tests for single modules and functions can ran with
e.g. ./ynh-dev test yunohost/appurl:urlavailable
```

However it looks like the example is not working:
```
ERROR: file or directory not found: tests/test_appurl.py::test_urlavailable
```

Running with `bash -x ./ynh-test ...` reveals that the script moves to this directory:
```
cd /ynh-dev/yunohost/src/tests
```

IDK if that's expected or if something has to be changed (either the code or the documentation)
[12:13:56] <florent[m]> Hopefully I could run the tests using `py.test ./tests/test_app_resources.py`.
[20:41:45] <orhtej2> I mean WFM:

```
root@ynh-dev-bookworm-unstable:/ynh-dev# ./ynh-dev test yunohost/appurl:urlavailable
[INFO] Running tests for YunoHost
Test session starts (platform: linux, Python 3.11.2, pytest 8.4.2, pytest-sugar 1.1.1)
cachedir: .pytest_cache
rootdir: /ynh-dev/yunohost
configfile: pyproject.toml
plugins: mock-3.15.1, sugar-1.1.1, requests-mock-1.12.1, anyio-3.6.2
collected 1 item

tests/test_appurl.py::test_urlavailable ✓ 100% ██████████

Results (0.73s):
1 passed
```

Are you running from inside of ynh-dev container? did you `apt update` and `yunohost tool postinstall` first? Domain is semi-non-negotiable, it's `yolo.swag` or you unleash heavenly wrath
[20:42:34] <florent[m]> Thank you for your answer
I think, let me try again
[20:50:19] <florent[m]> `git pull` on `ynh-dev` and hmm...
```diff
diff --git a/ynh-dev b/ynh-dev
old mode 100755
new mode 100644
index e2fea8e..aa332d2
--- a/ynh-dev
+++ b/ynh-dev
@@ -553,8 +553,15 @@ function run_tests()
fi
done

+ # ./src/tests is being moved to ./tests, this small patch supports both paths
+ if [[ -e "/ynh-dev/yunohost/tests/conftest.py" ]]; then
+ tests_parentdir=/ynh-dev/yunohost
+ else
+ tests_parentdir=/ynh-dev/yunohost/src
+ fi
+
# Apps for test
- cd /ynh-dev/yunohost/src/tests
+ cd "$tests_parentdir/tests"
```
[20:51:20] <florent[m]> Works more as expected:
```
root@yolo:/ynh-dev# ./ynh-dev test yunohost/appurl:urlavailable
[INFO] Running tests for YunoHost
Test session starts (platform: linux, Python 3.11.2, pytest 8.4.2, pytest-sugar 1.1.1)
cachedir: .pytest_cache
rootdir: /ynh-dev/yunohost
configfile: pyproject.toml
plugins: sugar-1.1.1, mock-3.15.1, requests-mock-1.12.1, anyio-3.6.2
collected 1 item


―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_urlavailable ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

def test_urlavailable():
# Except the maindomain/macnuggets to be available
assert domain_url_available(maindomain, "/macnuggets")

# We don't know the domain yolo.swag
> with pytest.raises(YunohostError):
E Failed: DID NOT RAISE <class 'yunohost.utils.error.YunohostError'>

tests/test_appurl.py:121: Failed

tests/test_appurl.py::test_urlavailable ⨯ 100% ██████████
============================================================================================= short test summary info ==============================================================================================
FAILED tests/test_appurl.py::test_urlavailable - Failed: DID NOT RAISE <class 'yunohost.utils.error.YunohostError'>

Results (0.95s):
1 failed
- tests/test_appurl.py:116 test_urlavailable
```
[20:52:06] <orhtej2> Welp, pull yunohost repo?
[20:52:58] <florent[m]> You mean `./ynh-dev use-git yunohost` or something else?
[20:53:24] <florent[m]> I have pulled the yunohost repo too. But let's see what happens when I pull `moulinette` too
[20:54:33] <florent[m]> Same result, but maybe that's something stupid again.
[20:54:45] <florent[m]> Thanks for your help orhtej2! 🙏
[20:54:56] <florent[m]> I go to sleep, need to rest
[21:00:14] <orhtej2> > You mean `./ynh-dev use-git yunohost` or something else?

As in cd yunohost && git pull 😜
[21:00:40] <orhtej2> given your ynh-dev required pulling