✨ feat(packaging): declare tox.pytest deps via a testing extra - #3940
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
tox.pytestmodule exposes a pytest plugin for testing tox itself and tox plugins, but its runtime imports ofpytest,pytest-mockanddevpi-processwere never declared in the package metadata. 🐛 Plugin authors who wiredpytest_plugins = "tox.pytest"into theirconftest.pyhad to discover and pin those transitive dependencies by hand, and would otherwise hit anImportErrorondevpi_processbefore any test could run, as reported in #3938.The fix exposes them through a new
testingoptional dependency, so consumers can pull the full fixture surface in viatox[testing]while the base install stays free of test-only packages. ✨ The version floors mirror those already in thetestdependency group used by tox itself, keeping a single source of truth for the supported lower bounds.Plugin-author docs in
docs/plugin/howto.rstgain a shortTesting pluginssection pointing at the new extra and showing thepytest_pluginshookup, so the workflow is discoverable from the plugin guide.Closes #3938.