From 65ede5b5966db19ba7e6c2f02638bd16fe373ef9 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 23 Oct 2025 17:06:22 +0300 Subject: [PATCH 1/5] tox: require tox>=4 Tox 4.0.0 was released on Dec 7, 2022, should be OK to require it. On the way, since `minversion` is deprecated, replace it with `require`. https://tox.wiki/en/latest/config.html#min_version --- changelog/13841.contrib.rst | 1 + tox.ini | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/13841.contrib.rst diff --git a/changelog/13841.contrib.rst b/changelog/13841.contrib.rst new file mode 100644 index 00000000000..e5672634700 --- /dev/null +++ b/changelog/13841.contrib.rst @@ -0,0 +1 @@ +``tox>=4`` is now required when contributing to pytest. diff --git a/tox.ini b/tox.ini index fa86c9c4403..f3e4cdc12c1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ [tox] isolated_build = True -minversion = 3.20.0 +requires = + tox >= 4 distshare = {homedir}/.tox/distshare envlist = linting From 0075c57cb7da8bdb21785d06786a728faa55ceb5 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 23 Oct 2025 17:03:52 +0300 Subject: [PATCH 2/5] tox: remove `distshare` setting As far as I can see this setting no longer exists in tox 4, and probably not utilized before either, so should be safe to remove. --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index f3e4cdc12c1..520799b019d 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,6 @@ isolated_build = True requires = tox >= 4 -distshare = {homedir}/.tox/distshare envlist = linting py310 From 66429cef4c3b02adce66f7cf39cce134da0ac173 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 23 Oct 2025 17:09:01 +0300 Subject: [PATCH 3/5] tox: remove `isolated_build` setting According to https://tox.wiki/en/stable/upgrading.html#removed-tox-ini-keys: "Isolated builds are now always used." --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 520799b019d..9e1d2f7079e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,4 @@ [tox] -isolated_build = True requires = tox >= 4 envlist = From 20741b447f0241db7e40ad0ed21f205efd456c95 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 23 Oct 2025 17:16:33 +0300 Subject: [PATCH 4/5] tox: use the same wheel for all environments Since pytest wheel is "universal" (not different between Python versions or implementations or anything), the same wheel can be reused. See: https://tox.wiki/en/stable/config.html#wheel_build_env https://tox.wiki/en/stable/upgrading.html#universal-wheels --- tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tox.ini b/tox.ini index 9e1d2f7079e..a47f944133a 100644 --- a/tox.ini +++ b/tox.ini @@ -93,6 +93,9 @@ deps = xdist: pytest-xdist>=2.1.0 xdist: -e . {env:_PYTEST_TOX_EXTRA_DEP:} +# Can use the same wheel for all environments. +package = wheel +wheel_build_env = .pkg [testenv:linting] description = From 0ed35d5f904669630834f1141cd618b2b28360e3 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 23 Oct 2025 17:19:51 +0300 Subject: [PATCH 5/5] tox: remove `basepython = python3` lines I don't think they're needed. --- tox.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tox.ini b/tox.ini index a47f944133a..1203bfe2352 100644 --- a/tox.ini +++ b/tox.ini @@ -101,7 +101,6 @@ wheel_build_env = .pkg description = run pre-commit-defined linters under `{basepython}` skip_install = True -basepython = python3 deps = pre-commit>=2.9.3 commands = pre-commit run --all-files --show-diff-on-failure {posargs:} setenv = @@ -129,7 +128,6 @@ setenv = [testenv:docs-checklinks] description = check the links in the documentation with `{basepython}` -basepython = python3 usedevelop = True changedir = doc/en deps = -r{toxinidir}/doc/en/requirements.txt @@ -143,7 +141,6 @@ setenv = description = regenerate documentation examples under `{basepython}` changedir = doc/en -basepython = python3 passenv = SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST deps = @@ -196,7 +193,6 @@ commands = [testenv:release] description = do a release, required posarg of the version number -basepython = python3 usedevelop = True passenv = * deps = @@ -214,7 +210,6 @@ commands = python scripts/prepare-release-pr.py {posargs} [testenv:generate-gh-release-notes] description = generate release notes that can be published as GitHub Release -basepython = python3 usedevelop = True deps = pypandoc