Skip to content

✨ feat(packaging): declare tox.pytest deps via a testing extra - #3940

Merged
gaborbernat merged 4 commits into
tox-dev:mainfrom
gaborbernat:3938
May 12, 2026
Merged

gaborbernat merged 4 commits into
tox-dev:mainfrom
gaborbernat:3938

Conversation

@gaborbernat

@gaborbernat gaborbernat commented May 12, 2026 •

Copy link
Copy Markdown
Member

The tox.pytest module exposes a pytest plugin for testing tox itself and tox plugins, but its runtime imports of pytest, pytest-mock and devpi-process were never declared in the package metadata. 🐛 Plugin authors who wired pytest_plugins = "tox.pytest" into their conftest.py had to discover and pin those transitive dependencies by hand, and would otherwise hit an ImportError on devpi_process before any test could run, as reported in #3938.

The fix exposes them through a new testing optional dependency, so consumers can pull the full fixture surface in via tox[testing] while the base install stays free of test-only packages. ✨ The version floors mirror those already in the test dependency group used by tox itself, keeping a single source of truth for the supported lower bounds.

Plugin-author docs in docs/plugin/howto.rst gain a short Testing plugins section pointing at the new extra and showing the pytest_plugins hookup, so the workflow is discoverable from the plugin guide.

Closes #3938.

The tox.pytest plugin imports pytest, devpi-process and pytest-mock
at runtime, but none of these were declared in the package metadata.
Plugin authors who wired up pytest_plugins = "tox.pytest" had to
discover and pin each transitive dependency themselves, and would
hit ImportError on devpi_process before any test ran.

Expose them through a new testing extra so consumers can pull the
full fixture surface in with tox[testing], keeping the base install
free of test-only dependencies.
The howto page references the new testing extra with :mod:`tox.pytest`,
but the module had no Sphinx target so the build failed under -W. Pull
the testing extra into the docs env so autodoc can import it, and add
a "testing" section to the plugin API reference covering ToxProject,
ToxProjectCreator and ToxRunOutcome.
The test runs interpreter discovery for a fake architecture
(cpython3-64-fakearch999) and asserts that tox reports it as
missing. On slow Windows runners the discovery scan can exceed the
30s pytest timeout while it walks every candidate location before
giving up, causing the worker thread inside execute() to still be
mid-join when the timeout fires.

Apply the same flaky(max_runs=3, min_passes=1) treatment used by
the other timing-sensitive Windows tests in this file so a single
slow run does not fail the suite.
Replace the flaky retry on test_machine_factor_unavailable with an
explicit 120s timeout. The test legitimately exercises python-discovery
scanning every candidate location for cpython3-64-fakearch999 before
giving up, which exceeds the suite-wide 30s default on slow Windows
runners. Retrying just rolls the same slow path three times; bumping
the budget reflects the real cost.
@gaborbernat
gaborbernat merged commit 6eb5c4f into tox-dev:main May 12, 2026
27 checks passed
@gaborbernat
gaborbernat deleted the 3938 branch July 10, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tox.pytest's deps are not declared in the metadata

1 participant