mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
mypy_test.py: warn about incompatible python version only on tested files (#12079)
This commit is contained in:
@@ -527,26 +527,26 @@ def test_third_party_stubs(args: TestConfig, tempdir: Path) -> TestSummary:
|
||||
if spec_matches_path(gitignore_spec, distribution_path):
|
||||
continue
|
||||
|
||||
metadata = read_metadata(distribution)
|
||||
if not metadata.requires_python.contains(PYTHON_VERSION):
|
||||
msg = (
|
||||
f"skipping {distribution!r} (requires Python {metadata.requires_python}; "
|
||||
f"test is being run using Python {PYTHON_VERSION})"
|
||||
)
|
||||
print(colored(msg, "yellow"))
|
||||
summary.skip_package()
|
||||
continue
|
||||
if not metadata.requires_python.contains(args.version):
|
||||
msg = f"skipping {distribution!r} for target Python {args.version} (requires Python {metadata.requires_python})"
|
||||
print(colored(msg, "yellow"))
|
||||
summary.skip_package()
|
||||
continue
|
||||
|
||||
if (
|
||||
distribution_path in args.filter
|
||||
or Path("stubs") in args.filter
|
||||
or any(distribution_path in path.parents for path in args.filter)
|
||||
):
|
||||
metadata = read_metadata(distribution)
|
||||
if not metadata.requires_python.contains(PYTHON_VERSION):
|
||||
msg = (
|
||||
f"skipping {distribution!r} (requires Python {metadata.requires_python}; "
|
||||
f"test is being run using Python {PYTHON_VERSION})"
|
||||
)
|
||||
print(colored(msg, "yellow"))
|
||||
summary.skip_package()
|
||||
continue
|
||||
if not metadata.requires_python.contains(args.version):
|
||||
msg = f"skipping {distribution!r} for target Python {args.version} (requires Python {metadata.requires_python})"
|
||||
print(colored(msg, "yellow"))
|
||||
summary.skip_package()
|
||||
continue
|
||||
|
||||
distributions_to_check[distribution] = get_recursive_requirements(distribution)
|
||||
|
||||
# Setup the necessary virtual environments for testing the third-party stubs.
|
||||
|
||||
@@ -292,14 +292,14 @@ def concurrently_run_testcases(
|
||||
for testcase_dir, tempdir in packageinfo_to_tempdir.items():
|
||||
pkg = testcase_dir.name
|
||||
requires_python = None
|
||||
if not testcase_dir.is_stdlib: # type: ignore[misc] # mypy bug, already fixed on master
|
||||
if not testcase_dir.is_stdlib:
|
||||
requires_python = read_metadata(pkg).requires_python
|
||||
if not requires_python.contains(PYTHON_VERSION):
|
||||
msg = f"skipping {pkg!r} (requires Python {requires_python}; test is being run using Python {PYTHON_VERSION})"
|
||||
print(colored(msg, "yellow"))
|
||||
continue
|
||||
for version in versions_to_test:
|
||||
if not testcase_dir.is_stdlib: # type: ignore[misc] # mypy bug, already fixed on master
|
||||
if not testcase_dir.is_stdlib:
|
||||
assert requires_python is not None
|
||||
if not requires_python.contains(version):
|
||||
msg = f"skipping {pkg!r} for target Python {version} (requires Python {requires_python})"
|
||||
|
||||
Reference in New Issue
Block a user