test: run the near-miss label guards in the default tox env - #1089
Open
dchaudhari7177 wants to merge 1 commit into
Open
test: run the near-miss label guards in the default tox env#1089dchaudhari7177 wants to merge 1 commit into
dchaudhari7177 wants to merge 1 commit into
Conversation
tests/test_documentation/test_near_miss_labels_in_docs.py exists to redden when a near-miss stage label is renamed and a published page keeps quoting the old one. The default [testenv] command passes --ignore=tests/test_documentation and only python314 clears DEACTIVATE_NOTEBOOK_AND_DOC_TESTS, so a contributor running tox locally renames a label, sees green, and pushes a page quoting a label no stage carries. CI runs the 3.14 env, so the gate holds there, which is what made the hole invisible. Move the file to tests/test_docs_near_miss_labels.py, next to test_docs_fences.py, which already sits outside tests/test_documentation for exactly this reason and says so in its docstring. The guards move whole rather than split by dependency. All 46 cases are string parsing over docs/docs/**.md plus a _STAGE_LABELS import, and the one self-test that renders a real failure builds an EvaluationResult and calls render_resolution_failure directly, so it needs no backend and no flight server. The whole file runs in 0.21s. Moving it whole also keeps one home for the label vocabulary, which a split would have had to duplicate or export. Collected by the default env's own selection (--ignore=tests/test_documentation): 0 label guards on main, 46 on this branch. Renaming _STAGE_LABELS['input_data'] from 'input data' to 'input source' then fails 4 of them, naming docs/docs/in_depth/data-access-patterns.md and the troubleshooting label table. On main the same rename is green under that selection. REPO_ROOT moves from parents[2] to parents[1], since the file sits one level shallower now. Everything else is unchanged. Closes mloda-ai#1082
dchaudhari7177
force-pushed
the
test/label-guards-in-default-tox-env
branch
from
August 7, 2026 03:50
fba7b38 to
a4a60b0
Compare
Collaborator
|
@dchaudhari7177 Please rebase your PR. |
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.
Closes #1082.
The hole
The default
[testenv]command passes--ignore=tests/test_documentation, and onlypython314clearsDEACTIVATE_NOTEBOOK_AND_DOC_TESTS. So the near-miss label guards — the tests whose whole job is to redden when a stage label is renamed and a published page keeps quoting the old one — never run under a plain localtox. CI runs the 3.14 env, so the gate holds there, which is exactly what made the hole invisible.The change
Move
tests/test_documentation/test_near_miss_labels_in_docs.pytotests/test_docs_near_miss_labels.py, next totest_docs_fences.py— the precedent named in the issue, which already sits outsidetests/test_documentationfor this reason and says so in its docstring.Moved whole rather than split by dependency. All 46 cases are string parsing over
docs/docs/**.mdplus a_STAGE_LABELSimport, and the one self-test that renders a real failure builds anEvaluationResultand callsrender_resolution_failuredirectly, so it needs no backend and no flight server. The whole file runs in 0.21s. Moving it whole also keeps one home for the label vocabulary (ALLOWED_LABELS,NEAR_MISS_BULLET_PATTERN,DOC_BULLET_STAGES,PROSE_LABEL_PAGES,LABEL_TABLE_PAGE), which a split would have had to duplicate or export.The diff is the rename, the docstring paragraph explaining the placement, and
REPO_ROOTmoving fromparents[2]toparents[1]because the file sits one level shallower. Nothing else changes.Verification
Label guards collected by the default env's own selection,
pytest --ignore=tests/test_documentation -m 'not notebooks':Then the rename the guard exists to catch —
_STAGE_LABELS["input_data"]from"input data"to"input source", under that same selection:The stale page and the troubleshooting label table are both named. On main the same rename is green under that selection. Source file restored afterwards —
git diff main -- mloda/is empty on this branch.Gates on the moved file:
ruff format --check --line-length 120,ruff check,mypy --strict --ignore-missing-importsall clean. No remaining references to the old path anywhere in the repo.One note on the issue text
The issue mentions "the two self-tests that render a real failure and drive
GlobalFilter.warn_on_unmatched_filters". In this file there is one such self-test (test_the_scanner_pattern_matches_a_rendered_near_miss_bullet); nothing here toucheswarn_on_unmatched_filters. It made no difference to the outcome, since the render is backend-free either way and the file moved whole — flagging it in case a second guard was meant to exist and is missing.Rebased onto current
main(9caea51d), which picked up theparents[2]anchoring and the relative parametrize ids from #937 in the meantime; this branch keeps those as they are.