@@ -14,6 +14,7 @@ Please report issues on the following repository: <https://github.com/yunohost/i
1414 - [ 2. Manage YunoHost's dev LXCs] ( #2-manage-yunohosts-dev-lxcs )
1515 - [ 3. Development and container testing] ( #3-development-and-container-testing )
1616 - [ 4. Testing the web interface] ( #4-testing-the-web-interface )
17+ - [ 5. Running the automated tests] ( #5-running-the-automated-tests )
1718 - [ Advanced: using snapshots] ( #advanced-using-snapshots )
1819 - [ Troubleshooting] ( #troubleshooting )
1920 - [ Remote Development Environment] ( #remote-development-environment )
@@ -228,6 +229,46 @@ Note that `./ynh-dev use-git yunohost-admin` has a particular behavior: it start
228229that shall re-compile automatically any changes in the javascript code. Hence this particular ` use-git `
229230will keep running until you kill it after your work is done.
230231
232+ ### 5. Running the automated tests
233+
234+ In packages like ` yunohost ` , you have automated non-regression tests at your disposal (that you may change if you want to suggest changes).
235+
236+ > [ !TIP]
237+ > You might be interested in creating a separate incus container to run your tests than for the one you use for packages
238+ >
239+ > In such case, you may initiate or attach the container with a specific name, like:
240+ >
241+ > ``` bash
242+ > ./ynh-dev start bookworm ynh-test
243+ > ` ` `
244+ >
245+ > And run ` yunohost tool postinstall` like for the other container.
246+
247+ To run the tests, supposing you already have run ` ./ynh-dev use-git PKG` , inside the container, you may run:
248+
249+ ` ` ` bash
250+ ./ynh-dev test PKG
251+ ```
252+
253+ Say you want to run all the Python tests of Yunohost (not the bash helpers tests though):
254+
255+ ``` bash
256+ ./ynh-dev test yunohost
257+ ```
258+
259+ Or specifically the test file ` tests/test_appurl.py ` :
260+
261+ ``` bash
262+ ./ynh-dev test yunohost appurl
263+ ```
264+
265+ Or even exclusively the test function named ` test_urlavailable() ` inside that test file:
266+ ``` bash
267+ ./ynh-dev test yunohost/appurl:urlavailable
268+ ```
269+
270+ Note that ` ./ynh-dev test ` will install all the required dependencies (` pip ` , ` pytest ` , ` mock ` ) for you.
271+
231272### Advanced: using snapshots
232273
233274You can check ` incus snapshot --help ` to learn how to manage incus snapshots.
0 commit comments