Skip to content

[PR #12747/419bc7a7 backport][8.3.x] Use oldest supported Python in mypy pre-commit checks #12750

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repos:
- id: mypy
files: ^(src/|testing/|scripts/)
args: []
language_version: "3.8"
additional_dependencies:
- iniconfig>=1.1.0
- attrs>=19.2.0
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


if TYPE_CHECKING:
from typing import Self
from typing_extensions import Self

from _pytest.fixtures import FixtureManager

Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
del sys.last_value
del sys.last_traceback
if sys.version_info >= (3, 12, 0):
del sys.last_exc
del sys.last_exc # type:ignore[attr-defined]

Check warning on line 170 in src/_pytest/runner.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/runner.py#L170

Added line #L170 was not covered by tests
except AttributeError:
pass
try:
Expand All @@ -177,7 +177,7 @@
sys.last_type = type(e)
sys.last_value = e
if sys.version_info >= (3, 12, 0):
sys.last_exc = e
sys.last_exc = e # type:ignore[attr-defined]

Check warning on line 180 in src/_pytest/runner.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/runner.py#L180

Added line #L180 was not covered by tests
assert e.__traceback__ is not None
# Skip *this* frame
sys.last_traceback = e.__traceback__.tb_next
Expand Down
2 changes: 1 addition & 1 deletion testing/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@
assert sys.last_type is IndexError
assert isinstance(sys.last_value, IndexError)
if sys.version_info >= (3, 12, 0):
assert isinstance(sys.last_exc, IndexError)
assert isinstance(sys.last_exc, IndexError) # type:ignore[attr-defined]

Check warning on line 1033 in testing/test_runner.py

View check run for this annotation

Codecov / codecov/patch

testing/test_runner.py#L1033

Added line #L1033 was not covered by tests

assert sys.last_value.args[0] == "TEST"
assert sys.last_traceback
Expand Down
Loading