mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-19 18:31:14 +08:00
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:
@@ -132,6 +132,14 @@ def parse_stdlib_versions_file() -> SupportedVersionsDict:
|
||||
return result
|
||||
|
||||
|
||||
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]
|
||||
|
||||
|
||||
def _parse_version(v_str: str) -> tuple[int, int]:
|
||||
m = VERSION_RE.match(v_str)
|
||||
assert m, f"invalid version: {v_str}"
|
||||
|
||||
Reference in New Issue
Block a user