Skip to content

🧪 test(docs): validate doc config examples to prevent regressions#3875

Open
gaborbernat wants to merge 4 commits intotox-dev:mainfrom
gaborbernat:doc-fix
Open

🧪 test(docs): validate doc config examples to prevent regressions#3875
gaborbernat wants to merge 4 commits intotox-dev:mainfrom
gaborbernat:doc-fix

Conversation

@gaborbernat
Copy link
Member

Discussion #3874 showed that many TOML examples in the documentation were silently broken — replace = "if" conditionals inside deps and commands lists were missing extend = 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:: toml and .. code-block:: ini directive across all RST files under docs/, classifies each block by config format (tox.toml, pyproject.toml, tox.ini, setup.cfg), and runs tox c to 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 = true to ~35 conditional replacement examples and correct a broken ref of path 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.

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.
@gaborbernat gaborbernat added the type:internal should have no impact on the user (refactoring, infrastructure, tools, etc.) label Mar 12, 2026
Functions now appear in topological usage order. Removed unnecessary
__init__.py from tests/docs/ and inlined single-use variables.
@luziferius
Copy link

Thanks for the fixes!

@gaborbernat gaborbernat force-pushed the doc-fix branch 8 times, most recently from 6ae123c to dea5d52 Compare March 12, 2026 21:20
@gaborbernat gaborbernat enabled auto-merge (squash) March 12, 2026 21:20
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided type:internal should have no impact on the user (refactoring, infrastructure, tools, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants