Project: Run pytest with `--dist loadscope`

This option forces tests to be grouped by module and run by the same
worker. This avoids some race conditions that cause tests to fail when
they attempt to bind to the same port. This cannot be solved with any
kind of lock because the tests were being run by completely different
processes.
This commit is contained in:
Mike Salvatore 2022-09-16 10:13:40 -04:00
parent f6270400b6
commit 5233dfd2b5
1 changed files with 2 additions and 2 deletions

View File

@ -76,7 +76,7 @@ jobs:
## run unit tests and generate coverage data ## run unit tests and generate coverage data
- cd monkey # this is our source dir - cd monkey # this is our source dir
- pip install pytest-xdist - pip install pytest-xdist
- python -m pytest -n auto --cov=. # have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path. - python -m pytest -n auto --dist loadscope --cov=. # have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
# check js code. the npm install must happen after the flake8 because the node_modules folder will cause a lot of errors. # check js code. the npm install must happen after the flake8 because the node_modules folder will cause a lot of errors.
- cd monkey_island/cc/ui - cd monkey_island/cc/ui
@ -133,7 +133,7 @@ jobs:
## run unit tests and generate coverage data ## run unit tests and generate coverage data
- cd monkey # this is our source dir - cd monkey # this is our source dir
- pip install pytest-xdist - pip install pytest-xdist
- python -m pytest -n auto - python -m pytest -n auto --dist loadscope
notifications: notifications: