Skip to content

Commit c9041bd

Browse files
committed
Extend tox.ini with testpaths and {posargs} in poetry-pytest invocation
This allows limiting the scope of the test run, which can save much time. Run one test in one test environment: tox -e py39 -- tests/test_api.py::test_api Run one test in all test environments: tox -- tests/test_api.py::test_api Run all tests in one file in one test environment: tox -e py39 -- tests/test_api.py Run all tests in one file in all test environments: tox -- tests/test_api.py
1 parent 19b72ba commit c9041bd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tox.ini

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Run all tests:
2+
# tox
3+
# Run all tests in one file in all test environments:
4+
# tox -- tests/test_api.py
5+
# Run one test in all test environments:
6+
# tox -- tests/test_api.py::test_api
7+
# Run all tests in one file in one test environment:
8+
# tox -e py39 -- tests/test_api.py
9+
# Run one test in one test environment:
10+
# tox -e py39 -- tests/test_api.py::test_api
11+
112
[flake8]
213
exclude=connexion/__init__.py
314
rst-roles=class,mod,obj
@@ -21,6 +32,9 @@ python =
2132
3.11: py311-pypi,pre-commit
2233
3.12: py312-pypi
2334

35+
[pytest]
36+
testpaths = tests
37+
2438
[testenv]
2539
setenv=PYTHONPATH = {toxinidir}:{toxinidir}
2640
deps=
@@ -34,7 +48,7 @@ commands=
3448
poetry lock
3549
poetry install --all-extras --with tests
3650
poetry show
37-
poetry run python -m pytest tests --cov connexion --cov-report term-missing
51+
poetry run python -m pytest --cov connexion --cov-report term-missing {posargs}
3852
min: mv -f pyproject.toml.bak pyproject.toml
3953

4054
[testenv:pre-commit]

0 commit comments

Comments
 (0)