-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix type check failure stemming from new pytest release #9798
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
Conversation
The subject line doesn’t really cover the fix? |
I didn't do a great job with the original commit message... it looks like the release of pytest 6.2 broke mypy's type checking of itself: https://travis-ci.com/github/python/mypy/jobs/458991721 and https://docs.pytest.org/en/stable/changelog.html#pytest-6-2-0-2020-12-12 |
@@ -5,7 +5,8 @@ flake8-bugbear; python_version >= '3.5' | |||
flake8-pyi>=20.5; python_version >= '3.6' | |||
lxml>=4.4.0 | |||
psutil>=4.0 | |||
pytest>=6.1.0,<7.0.0 | |||
# pytest 6.2 does not support Python 3.5 | |||
pytest>=6.1.0,<6.2.0 |
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.
Can’t you select pre-6.2 for Python 3.5 only?
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.
Oh, oops... My urge to get things green was all consuming and I merged right before you posted this, sorry :-(
We definitely could, although in the past we've had to make changes to mypy source code based on pytest type annotation changes, so things are a little simpler if we stick to a single pytest version for all of mypy. Hopefully we can drop Python 3.5 support soon anyway.
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.
I worry that this declaration will stay behind even after we drop 3.5, and once we try to catch up with pytest we’d have a bunch of issues to debug all at once. But it’s fine, we can cross that bridge when we get to it.
IIUC, things broke here because the mypy self check runs on Python 3.7, which means the latest pytest gets installed (because it is compatible with Python 3.7, so pytest's The easiest fix would be to run the CI job itself on Python 3.5, but that may not be desirable. |
I think this is the right fix. test-requirements.txt is used by mypy devs, not just CI, and assuming most mypy devs aren't using Python 3.5 it would still make sense for it to specify a pytest that allows mypy's self type check to pass. |
The release of pytest 6.2 broke mypy's type checking of itself, since pytest 6.2 drops support for Python 3.5 (https://docs.pytest.org/en/stable/changelog.html#pytest-6-2-0-2020-12-12)