Skip to content

Commit

Permalink
Run tests randomly and in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
wummel committed Nov 4, 2024
1 parent c2dd893 commit a0b9639
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
run: |
uv tool install pytest
- name: Install pytest plugins xdist and randomly
run: |
uv pip install pytest-xdist[psutil] pytest-randomly
- name: Test with pytest
run: |
pytest -s tests/
pytest -s --full-trace --numprocesses auto tests/
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GIT_MAIN_BRANCH:=master
# -s: do not capture stdout/stderr (some tests fail otherwise)
# --full-trace: print full stacktrace on keyboard interrupts
# --log-file: write test output to file for easier inspection
PYTESTOPTS?=-s --full-trace --log-file=build/test.log
# --numprocesses auto: run tests in parallel on available CPU cores (uses pytest-xdist)
PYTESTOPTS?=-s --full-trace --log-file=build/test.log --numprocesses auto
# which test modules to run
TESTS ?= tests/
# set test options
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ dev-dependencies = [

# for testing
"pytest==8.3.3",
# plugin to run tests in parallel
"pytest-xdist[psutil]==3.6.1",
# plugin to run tests in random order
"pytest-randomly==3.16.0",

# for python code linting
"ruff==0.7.2",
Expand Down

0 comments on commit a0b9639

Please sign in to comment.