Skip to content

Commit

Permalink
move pytest coverage and parallelization to tox
Browse files Browse the repository at this point in the history
* enables more usable/debuggable direct runs of pytest without changing config
* also fixed `posargs` default behavior on unit env to match the others
  • Loading branch information
nitzmahone committed Apr 27, 2023
1 parent 613f24f commit 388b7b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 0 additions & 5 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ addopts =
--color yes
--showlocals
--verbose
--numprocesses auto
--durations 10
--durations-min 1
--strict-markers
--cov
--cov-report html
--cov-report term
--cov-report xml
13 changes: 8 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
envlist = linters, unit
isolated_build = True

[shared]
pytest_cov_args = --cov --cov-report html --cov-report term --cov-report xml

[testenv]
description = Run all tests with {basepython}
usedevelop = True
Expand All @@ -20,15 +23,15 @@ commands =

[testenv:unit{,-py39,-py310,-py311}]
description = Run unit tests
commands = pytest {posargs:test/unit}
commands = pytest test/unit {posargs} {[shared]pytest_cov_args}

[testenv:pulp-integration{-py39,-py310,-py311}]
# Some of these tests must run serially because of a shared resource
# (the system policy.json file).
description = Run pulp integration tests
commands =
pytest -n 0 -m "serial" test/pulp_integration {posargs}
pytest -m "not serial" test/pulp_integration {posargs}
pytest -n 0 -m "serial" test/pulp_integration {posargs} {[shared]pytest_cov_args}
pytest -m "not serial" test/pulp_integration {posargs} {[shared]pytest_cov_args}

[testenv:integration{,-py39,-py310,-py311}]
description = Run integration tests
Expand All @@ -37,8 +40,8 @@ passenv =
HOME
KEEP_IMAGES
commands =
pytest -m "not serial" test/integration {posargs}
pytest -n 0 -m "serial" test/integration {posargs}
pytest -m "not serial" test/integration {posargs} {[shared]pytest_cov_args}
pytest -n 0 -m "serial" test/integration {posargs} {[shared]pytest_cov_args}

[testenv:docs]
description = Build documentation
Expand Down

0 comments on commit 388b7b9

Please sign in to comment.