diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbee593f7c2..e11493d1b44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,6 +61,7 @@ jobs: "windows-py310-unittest-twisted25", "windows-py310-pluggy", "windows-py310-xdist", + "windows-py310-lowestdirect-onlymanaged", "windows-py311", "windows-py312", "windows-py313", @@ -73,6 +74,7 @@ jobs: "ubuntu-py310-pluggy", "ubuntu-py310-freeze", "ubuntu-py310-xdist", + "ubuntu-py310-lowestdirect-onlymanaged", "ubuntu-py311", "ubuntu-py312", "ubuntu-py313-pexpect", @@ -80,6 +82,7 @@ jobs: "ubuntu-pypy3-xdist", "macos-py310", + "macos-py310-lowestdirect-onlymanaged", "macos-py312", "macos-py313", "macos-py314", @@ -119,6 +122,12 @@ jobs: os: windows-latest tox_env: "py310-xdist" + - name: "windows-py310-lowestdirect-onlymanaged" + python: "3.10" + os: windows-latest + tox_env: "py310-lowestdirect-onlymanaged" + use_uv: true + - name: "windows-py311" python: "3.11" os: windows-latest @@ -182,6 +191,12 @@ jobs: os: ubuntu-latest tox_env: "py310-xdist" + - name: "ubuntu-py310-lowestdirect-onlymanaged" + python: "3.10" + os: ubuntu-latest + tox_env: "py310-lowestdirect-onlymanaged" + use_uv: true + - name: "ubuntu-py311" python: "3.11" os: ubuntu-latest @@ -219,6 +234,13 @@ jobs: tox_env: "py310-xdist" xfail: true + - name: "macos-py310-lowestdirect-onlymanaged" + python: "3.10" + os: macos-latest + tox_env: "py310-lowestdirect-onlymanaged" + xfail: true + use_uv: true + - name: "macos-py312" python: "3.12" os: macos-latest @@ -273,6 +295,11 @@ jobs: python -m pip install --upgrade pip pip install tox coverage + - name: Set up uv + if: "matrix.use_uv" + shell: bash + run: pip install tox-uv + - name: Test without coverage if: "! matrix.use_coverage" shell: bash diff --git a/changelog/13177.packaging.rst b/changelog/13177.packaging.rst new file mode 100644 index 00000000000..ef4d0c8ab0b --- /dev/null +++ b/changelog/13177.packaging.rst @@ -0,0 +1,3 @@ +Raised minimal versions of ``exceptiongroup``, ``iniconfig`` and ``pygments`` following uv powered test runs using the ``lowest-direct`` resolution strategy. + +-- by :user:`sgaist` diff --git a/pyproject.toml b/pyproject.toml index f57d7e8e85b..2bc04f2cf90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,21 +47,21 @@ dynamic = [ ] dependencies = [ "colorama>=0.4; sys_platform=='win32'", - "exceptiongroup>=1; python_version<'3.11'", - "iniconfig>=1.0.1", + "exceptiongroup>=1.1; python_version<'3.11'", + "iniconfig>=2", "packaging>=22", "pluggy>=1.5,<2", - "pygments>=2.7.2", + "pygments>=2.14", "tomli>=1; python_version<'3.11'", ] optional-dependencies.dev = [ - "argcomplete", - "attrs>=19.2", - "hypothesis>=3.56", - "mock", - "requests", - "setuptools", - "xmlschema", + "argcomplete>=3.5", + "attrs>=21", + "hypothesis>=5", + "mock>=5", + "requests>=2.26", + "setuptools>=80", + "xmlschema>=3", ] urls.Changelog = "https://docs.pytest.org/en/stable/changelog.html" urls.Contact = "https://docs.pytest.org/en/stable/contact.html" diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index b9384008483..8ec0cddbf72 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1642,12 +1642,23 @@ def test_fail_call(): result = pytester.runpytest() assert result.ret == ExitCode.TESTS_FAILED result.assert_outcomes(failed=1, passed=1, errors=2) - result.stdout.fnmatch_lines( - [ - "=* short test summary info =*", - "FAILED test_it.py::test_fail_call - StopIteration: 3", - "ERROR test_it.py::test_fail_setup - StopIteration: 1", - "ERROR test_it.py::test_fail_teardown - StopIteration: 2", - "=* 1 failed, 1 passed, 2 errors in * =*", - ] - ) + + # uv managed python versions do not raise the same exception with regard to + # StopIteration. + # See PEP-0479 + runtime_errors = { + "FAILED test_it.py::test_fail_call - RuntimeError: generator raised StopIteration", + "ERROR test_it.py::test_fail_setup - RuntimeError: generator raised StopIteration", + "ERROR test_it.py::test_fail_teardown - RuntimeError: generator raised StopIte...", + } + got_runtime_errors = runtime_errors.issubset(result.outlines) + + stopiteration_errors = { + "FAILED test_it.py::test_fail_call - StopIteration: 3", + "ERROR test_it.py::test_fail_setup - StopIteration: 1", + "ERROR test_it.py::test_fail_teardown - StopIteration: 2", + } + + got_stopiteration_errors = stopiteration_errors.issubset(result.outlines) + + assert got_runtime_errors or got_stopiteration_errors diff --git a/tox-uv.ini b/tox-uv.ini new file mode 100644 index 00000000000..386a270034a --- /dev/null +++ b/tox-uv.ini @@ -0,0 +1,28 @@ +[tox] +requires = + tox>=4 + tox-uv>=1 +isolated_build = True +distshare = {homedir}/.tox/uv-distshare +envlist = + py310 + +[testenv] +description = + run the tests + under `{basepython}` +uv_resolution = lowest-direct +uv_python_preference = only-managed +commands = + {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} --maxfail=1 --pdb +passenv = + PYTEST_ADDOPTS + TERM + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST + CI +setenv = + _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} + +extras = dev +deps = + {env:_PYTEST_TOX_EXTRA_DEP:} diff --git a/tox.ini b/tox.ini index b6fcecc886a..a9eda9921dd 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ envlist = py313 py314 pypy3 - py310-{pexpect,xdist,twisted24,twisted25,asynctest,numpy,pluggymain,pylib} + py310-{pexpect,xdist,twisted24,twisted25,asynctest,numpy,pluggymain,pylib,lowestdirect,onlymanaged} doctesting doctesting-coverage plugins @@ -38,6 +38,8 @@ description = twisted25: against the unit test extras with twisted 25.0 or later asynctest: against the unit test extras with asynctest xdist: with pytest in parallel mode + lowestdirect: using lowest-direct resolution when running with uv + onlymanaged: using only managed python running with uv under `{basepython}` doctesting: including doctests commands = @@ -79,6 +81,10 @@ setenv = lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof xdist: _PYTEST_TOX_POSARGS_XDIST=-n auto +uv_resolution = + lowestdirect: lowest-direct +uv_python_preference = + onlymanaged: only-managed extras = dev deps = doctesting: PyYAML