Skip to content
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

fix for Pytest 8 compat #17066

Merged
merged 2 commits into from
Mar 26, 2024
Merged

fix for Pytest 8 compat #17066

merged 2 commits into from
Mar 26, 2024

Conversation

mr-c
Copy link
Contributor

@mr-c mr-c commented Mar 26, 2024

In Debian, we upgraded to pytest version 8.1.1+ for the next release.

pytest deprecated the name for the first positional argument to pytest.fail from msg to reason in Pytest 7.0 and removed msg in Pytest 8.0

https://docs.pytest.org/en/7.0.x/reference/reference.html#pytest-fail
https://docs.pytest.org/en/8.0.x/changelog.html#old-deprecations-are-now-errors

This comment has been minimized.

@mr-c
Copy link
Contributor Author

mr-c commented Mar 26, 2024

Ideally the minimum version of pytest would be increased to 8.1 and then the following additional change would be included, otherwise mypy will fail its self-checks with Pytest 8.1+

--- mypy.orig/mypy/test/data.py
+++ mypy/mypy/test/data.py
@@ -640,9 +640,7 @@
             # Non-None result means this obj is a test case.
             # The collect method of the returned DataSuiteCollector instance will be called later,
             # with self.obj being obj.
-            return DataSuiteCollector.from_parent(  # type: ignore[no-untyped-call]
-                parent=collector, name=name
-            )
+            return DataSuiteCollector.from_parent(parent=collector, name=name)
     return None

@AlexWaygood
Copy link
Member

AlexWaygood commented Mar 26, 2024

You could bump our pinned version of pytest by running pip-compile test-requirements.in --allow-unsafe --output-file=test-requirements.txt --strip-extras --upgrade-package pytest

Though if bumping pytest to 8.0+ requires changes to the self-test, then we might want to raise the lower bound specified in requirements.in, actually

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just waiting for CI to finish

@JelleZijlstra JelleZijlstra merged commit bebd278 into python:master Mar 26, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants