From 5233dfd2b54d4766bf0a15ca59068a77c46ce484 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 16 Sep 2022 10:13:40 -0400 Subject: [PATCH] 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. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea390e02b..2baed8ea6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,7 +76,7 @@ jobs: ## run unit tests and generate coverage data - cd monkey # this is our source dir - 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. - cd monkey_island/cc/ui @@ -133,7 +133,7 @@ jobs: ## run unit tests and generate coverage data - cd monkey # this is our source dir - pip install pytest-xdist - - python -m pytest -n auto + - python -m pytest -n auto --dist loadscope notifications: