[ty] Run lint documentation tests in mdtest.py (#26155)
`ty_python_semantic` now has two Markdown-based test suites in the same
Rust test harness. The existing semantic tests live under
`resources/mdtest` and have names such as `mdtest::loops/for.md`. The
new lint-rule documentation lives under `resources/lint_docs`; its code
examples are tests with names such as
`lint_doc::invalid-argument-type.md`. This PR updates the Python
`mdtest.py` development runner to handle both suites correctly.
## Run lint-documentation tests when their files change
An unfiltered invocation of `mdtest.py` already ran the new
documentation tests because it executed the entire Rust test binary.
Watch mode was incomplete, however: it only recognized changed Markdown
files under `resources/mdtest`, and it always constructed an exact test
name beginning with `mdtest::`. Changes under `resources/lint_docs` were
therefore ignored after the initial test run.
The runner now describes each suite using its Rust harness function and
fixture root. When a Markdown file changes, it uses that mapping to
identify both the path relative to the fixture root and the correct
test-name prefix. Editing
`resources/lint_docs/invalid-argument-type.md`, for example, now reruns
`lint_doc::invalid-argument-type.md`. The same suite information is
retained when rerunning a test after a pending snapshot is rejected.
## Match datatest's test-name format
The runner's command-line filter normalization was left over from the
old `dir-test` harness. `dir-test` flattened fixture paths into Rust
test names such as `mdtest__loops_for`, so `mdtest.py` converted
`loops/for.md` to `loops_for` by removing the extension and replacing
`/` and `-` with `_`.
The later migration to datatest changed test names to preserve fixture
paths, producing names such as `mdtest::loops/for.md`. That migration
updated the exact test name used by watch mode, but it did not remove
the old normalization applied to command-line filters. Consequently,
path-shaped filters no longer matched the tests they named. This became
particularly misleading with the documentation suite:
`invalid-argument-type.md` was converted to `invalid_argument_type`,
which selected the existing
`mdtest::diagnostics/invalid_argument_type.md` semantic test instead of
`lint_doc::invalid-argument-type.md`.
`mdtest.py` now removes only an optional `.md` suffix from command-line
filters, preserving the `/` and `-` characters used in datatest's names.