[ty] Use datatest instead of dirtest (#21937)

This commit is contained in:
Micha Reiser
2025-12-18 19:05:02 +01:00
committed by GitHub
parent f7ec178400
commit 42b972753a
8 changed files with 42 additions and 117 deletions

View File

@@ -129,17 +129,8 @@ class MDTestRunner:
check=False,
)
def _mangle_path(self, markdown_file: Path) -> str:
return (
markdown_file.as_posix()
.replace("/", "_")
.replace("-", "_")
.removesuffix(".md")
)
def _run_mdtests_for_file(self, markdown_file: Path) -> None:
path_mangled = self._mangle_path(markdown_file)
test_name = f"mdtest__{path_mangled}"
test_name = f"mdtest::{markdown_file}"
output = self._run_mdtest(["--exact", test_name], capture_output=True)
@@ -245,16 +236,10 @@ class MDTestRunner:
if rust_code_has_changed:
if self._recompile_tests("Rust code has changed, recompiling tests..."):
self._run_mdtest(self.filters)
elif vendored_typeshed_has_changed:
if self._recompile_tests(
"Vendored typeshed has changed, recompiling tests..."
):
self._run_mdtest(self.filters)
elif new_md_files:
files = " ".join(file.as_posix() for file in new_md_files)
self._recompile_tests(
f"New Markdown test [yellow]{files}[/yellow] detected, recompiling tests..."
)
elif vendored_typeshed_has_changed and self._recompile_tests(
"Vendored typeshed has changed, recompiling tests..."
):
self._run_mdtest(self.filters)
for path in new_md_files | changed_md_files:
self._run_mdtests_for_file(path)