-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter pytype tests by stdlib/VERSIONS file #12649
Conversation
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. The implementation was copied from mypy_test.py and adapted to fit into the existing pytype test setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this makes sense to me.
tests/pytype_test.py
Outdated
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you instead move supported_versions_for_module
from mypy_test.py
to _utils.py
and use the common function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Moved and imported from pytype and mypy tests.
Good to hear! I already have an exploratory PR for Python 3.12 + Windows support using development version of pytype: #12547 I can quickly spin it into an actual PR after the next release or you can pick from it if you get to it before me. |
@Avasam, your PR looks great. I'd probably keep the version check and just bump it. So the pytype tests now fail on Python 3.13 with a nice error message. But otherwise I think that's nice. I can ping on your PR once we release a new version (should be in the next few days, I hope tomorrow 🤞). |
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.
The implementation was copied from mypy_test.py and adapted to fit into the existing pytype test setup.
We're in the process of releasing a new pytype version, which will include basic support for Python 3.12. (I plan to send a separate PR for that soon.) When running pytype_test.py with that new version under 3.12 we saw errors like
As far as I understand the fix is to not run on stdlib/asynchat.pyi in the first place.