🧪 test(docs): validate doc config examples to prevent regressions#3875
Open
gaborbernat wants to merge 4 commits intotox-dev:mainfrom
Open
🧪 test(docs): validate doc config examples to prevent regressions#3875gaborbernat wants to merge 4 commits intotox-dev:mainfrom
gaborbernat wants to merge 4 commits intotox-dev:mainfrom
Conversation
Discussion tox-dev#3874 revealed TOML examples in docs were broken due to missing `extend = true` on conditional replacements inside lists. A one-off doc fix is fragile — these examples will drift again. Add a parametrized test that dynamically discovers every TOML and INI code block across all RST files, classifies each as tox.toml, pyproject.toml, or tox.ini, then runs `tox c` to verify the config parses without exceptions. This also fixes the broken `ref of` path in the raw reference doc example.
Functions now appear in topological usage order. Removed unnecessary __init__.py from tests/docs/ and inlined single-use variables.
|
Thanks for the fixes! |
6ae123c to
dea5d52
Compare
Replace Python version references in doc examples with current runtime version so tests pass on any system regardless of which interpreters are installed. Remove skip condition for unavailable interpreters since they're now replaced.
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.
Discussion #3874 showed that many TOML examples in the documentation were silently broken —
replace = "if"conditionals insidedepsandcommandslists were missingextend = true, causing tox to fail with type errors when users copied them. Fixing these by hand is fragile; the examples will drift again with the next doc edit. 📝This PR adds a parametrized test that dynamically discovers every
.. code-block:: tomland.. code-block:: inidirective across all RST files underdocs/, classifies each block by config format (tox.toml,pyproject.toml,tox.ini,setup.cfg), and runstox cto verify the config parses cleanly. The test currently validates 138 code blocks across 7 RST files. Blocks requiring unavailable infrastructure (specific Python interpreters, auto-provisioning plugins, virtualenv version pinning) are detected at collection time and skipped with clear reasons.The doc fixes themselves add the missing
extend = trueto ~35 conditional replacement examples and correct a brokenref ofpath in the raw reference documentation (["env", "extras"]→["env", "src", "extras"]). 🐛 Going forward, any new or edited config example that breaks will be caught by CI before it reaches users.