From ce3c3997cf1ac70ad03f4605d15598329d50b4e8 Mon Sep 17 00:00:00 2001 From: Chris Lott <10234212+chrisinmtown@users.noreply.github.com> Date: Thu, 17 Jul 2025 09:10:28 -0400 Subject: [PATCH] Extend tox.ini with {posargs} in poetry-pytest invocation This allows limiting the scope of the test run, which can save much time. Run all tests: tox Run all tests in one file in all test environments: tox -- tests/test_api.py Run one test in all test environments: tox -- tests/test_api.py::test_api Run all tests in one test environment: tox -e py39 Run all tests in one file in one test environment: tox -e py39 -- tests/test_api.py Run one test in one test environment: tox -e py39 -- tests/test_api.py::test_api --- tox.ini | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8667399f0..6a598415c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,16 @@ +# Run all tests: +# tox +# Run all tests in one file in all test environments: +# tox -- tests/test_api.py +# Run one test in all test environments: +# tox -- tests/test_api.py::test_api +# Run all tests in one test environment: +# tox -e py39 +# Run all tests in one file in one test environment: +# tox -e py39 -- tests/test_api.py +# Run one test in one test environment: +# tox -e py39 -- tests/test_api.py::test_api + [flake8] exclude=connexion/__init__.py rst-roles=class,mod,obj @@ -34,7 +47,7 @@ commands= poetry lock poetry install --all-extras --with tests poetry show - poetry run python -m pytest tests --cov connexion --cov-report term-missing + poetry run python -m pytest tests --cov connexion --cov-report term-missing {posargs} min: mv -f pyproject.toml.bak pyproject.toml [testenv:pre-commit]