diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb2d991..c0dc08b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,25 +41,25 @@ jobs: - uses: astral-sh/setup-uv@v8.2.0 - name: Install tox - run: uv tool install --with tox-gh-actions --with tox-uv tox + run: uv tool install --with tox-uv tox - name: Run tests with PyTest 9 run: tox env: - PYTEST_MAJOR_VERSION: 9 + TOXENV: ${{ matrix.python-version }}-pytest-9 PYTEST_PLUGINS: pytest_github_actions_annotate_failures,rerunfailures,xdist - name: Run tests with PyTest 8 run: tox env: - PYTEST_MAJOR_VERSION: 8 + TOXENV: ${{ matrix.python-version }}-pytest-8 PYTEST_PLUGINS: pytest_github_actions_annotate_failures,rerunfailures,xdist - name: Run tests with PyTest 7 run: tox if: runner.os != 'Windows' env: - PYTEST_MAJOR_VERSION: 7 + TOXENV: ${{ matrix.python-version }}-pytest-7 PYTEST_PLUGINS: pytest_github_actions_annotate_failures,rerunfailures,xdist post-test: diff --git a/tox.ini b/tox.ini deleted file mode 100644 index bff4bd0..0000000 --- a/tox.ini +++ /dev/null @@ -1,28 +0,0 @@ -[tox] -envlist = - py3{10-14}-pytest{7-9} - -[gh-actions] -python = - 3.10: py310 - 3.11: py311 - 3.12: py312 - 3.13: py313 - 3.14: py314 - -[gh-actions:env] -PYTEST_MAJOR_VERSION = - 7: pytest7 - 8: pytest8 - 9: pytest9 - -[testenv] -requires = - tox>=4.42 -dependency_groups = test -deps = - pytest7: pytest>=7.0.0,<8.0.0 - pytest8: pytest>=8.0.0,<9.0.0 - pytest9: pytest>=9.0.0,<10.0.0 - -commands = {envpython} -m pytest {posargs} diff --git a/tox.toml b/tox.toml new file mode 100644 index 0000000..8558c3d --- /dev/null +++ b/tox.toml @@ -0,0 +1,35 @@ +requires = [ + "tox>=4.49", + "tox-uv", +] +env_list = [ + { product = [ + { prefix = "py3", start = 10 }, + ["pytest"], + { pytestver = ["7", "8", "9"] }, + ] }, +] + +[env_run_base] +description = "run tests with Python {py_dot_ver} and pytest {factor:pytestver}" +deps = [ + { replace = "if", condition = "factor['9']", then = [ + "pytest>=9.0.0,<10.0.0", + ], extend = true }, + { replace = "if", condition = "factor['8']", then = [ + "pytest>=8.0.0,<9.0.0", + ], extend = true }, + { replace = "if", condition = "factor['7']", then = [ + "pytest>=7.0.0,<8.0.0", + "pytest-rerunfailures<16.2", + ], extend = true }, +] +dependency_groups = ["test"] +commands = [ + [ + "{envpython}", + "-m", + "pytest", + { replace = "posargs", default = [], extend = true }, + ], +]