Skip to content

Commit dd30548

Browse files
authored
Extend tox.ini with testpaths and {posargs} in poetry-pytest invocation (#2067)
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 f22a7a7 commit dd30548

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
@@ -22,6 +33,9 @@ python =
2233
3.13: py313-pypi
2334
3.14: py314-pypi
2435

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

4155
[testenv:pre-commit]

0 commit comments

Comments
 (0)