Filter pytype tests by stdlib/VERSIONS file (#12649)

Filter the files to run pytype tests on by stdlib/VERSIONS file. This
becomes important for Python 3.12, where e.g. checking asynchat.pyi
requires asyncore.pyi, both of which have been removed in 3.12.
This commit is contained in:
Jan Kühle
2024-09-12 18:40:19 +02:00
committed by GitHub
parent bc6b3b2aba
commit d326c9bd42
3 changed files with 28 additions and 16 deletions

View File

@@ -26,8 +26,6 @@ from _utils import (
PYTHON_VERSION,
STDLIB_PATH,
TESTS_DIR,
SupportedVersionsDict,
VersionTuple,
colored,
get_gitignore_spec,
get_mypy_req,
@@ -35,6 +33,7 @@ from _utils import (
print_error,
print_success_msg,
spec_matches_path,
supported_versions_for_module,
venv_python,
)
@@ -375,14 +374,6 @@ def stdlib_module_name_from_path(path: Path) -> str:
return ".".join(parts)
def supported_versions_for_module(module_versions: SupportedVersionsDict, module_name: str) -> tuple[VersionTuple, VersionTuple]:
while "." in module_name:
if module_name in module_versions:
return module_versions[module_name]
module_name = ".".join(module_name.split(".")[:-1])
return module_versions[module_name]
@dataclass
class TestSummary:
mypy_result: MypyResult = MypyResult.SUCCESS