diff --git a/.gitignore b/.gitignore index 222c8d331..0da65a4e4 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ analyze.py # pyenv local python version .python-version + +# deliberately local test configuration files +tests/stubtest_allowlists/*.local diff --git a/scripts/runtests.py b/scripts/runtests.py old mode 100644 new mode 100755 diff --git a/tests/README.md b/tests/README.md index 47437c599..3a0a109cf 100644 --- a/tests/README.md +++ b/tests/README.md @@ -133,6 +133,12 @@ test it automatically (or [running the test via Github Actions](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow) on your typeshed fork). +As a convenience, stubtest\_stdlib.py will look for local-only allowlist files +and use those if they are present. Only version-specific local allowlists are supported. +An example local allowlist file is +`tests/stubtest_allowlists/py312.txt.local`. Use caution when taking advantage of this feature; +the CI run of stubtest remains canonical. + If you need a specific version of Python to repro a CI failure, [pyenv](https://github.com/pyenv/pyenv) can also help. diff --git a/tests/check_new_syntax.py b/tests/check_new_syntax.py index 2c177597c..e0564362c 100755 --- a/tests/check_new_syntax.py +++ b/tests/check_new_syntax.py @@ -66,4 +66,5 @@ def main() -> None: if __name__ == "__main__": + assert sys.version_info >= (3, 9), "Python 3.9+ is required to run this test" main() diff --git a/tests/stubtest_stdlib.py b/tests/stubtest_stdlib.py index 32c512e4e..621f8262c 100755 --- a/tests/stubtest_stdlib.py +++ b/tests/stubtest_stdlib.py @@ -18,6 +18,7 @@ def run_stubtest(typeshed_dir: Path) -> int: version_allowlist = f"py{sys.version_info.major}{sys.version_info.minor}.txt" platform_allowlist = f"{sys.platform}.txt" combined_allowlist = f"{sys.platform}-py{sys.version_info.major}{sys.version_info.minor}.txt" + local_version_allowlist = version_allowlist + ".local" # Note when stubtest imports distutils, it will likely actually import setuptools._distutils # This is fine because we don't care about distutils and allowlist all errors from it @@ -39,6 +40,8 @@ def run_stubtest(typeshed_dir: Path) -> int: cmd += ["--allowlist", str(allowlist_dir / platform_allowlist)] if (allowlist_dir / combined_allowlist).exists(): cmd += ["--allowlist", str(allowlist_dir / combined_allowlist)] + if (allowlist_dir / local_version_allowlist).exists(): + cmd += ["--allowlist", str(allowlist_dir / local_version_allowlist)] if sys.version_info < (3, 10): # As discussed in https://github.com/python/typeshed/issues/3693, we only aim for # positional-only arg accuracy for python 3.10 and above.