Core: Allow running unit tests scoped to specific worlds (#6290)

This allows the unit tests to be run on specific worlds only, it works by using an environment variable AP_TEST_WORLDS which is a comma separated list of world directories.
This commit is contained in:
James White
2026-07-17 19:01:28 +01:00
committed by GitHub
parent c311685064
commit 9c80dc6257
31 changed files with 194 additions and 59 deletions
+16
View File
@@ -137,10 +137,26 @@ tests folder within your world.
You can also find the 'Archipelago Unittests' as an option in the dropdown at the top of the window
next to the run and debug buttons.
To run the suite scoped to a single world, use the shared **APQuest Tests** run configuration in the dropdown.
To test your own world, duplicate it in *Edit Configurations…* and change the `AP_TEST_WORLDS` environment
variable to your world's folder name.
#### Running Tests without Pycharm
Run `pip install pytest pytest-subtests`, then use your IDE to run tests or run `pytest` from the source folder.
#### Running Tests for Specific Worlds
Set the `AP_TEST_WORLDS` environment variable to a comma-separated list of world **folder** names to scope a run
to just those worlds:
```
AP_TEST_WORLDS=apquest pytest
```
Pass several worlds with a comma, e.g. `AP_TEST_WORLDS=apquest,pokemon_emerald`. Add
`--continue-on-collection-errors` if your environment is missing the webhost requirements (`flask`, etc.).
#### Running Tests Multithreaded
pytest can run multiple test runners in parallel with the pytest-xdist extension.