diff --git a/changelog/12744.bugfix.rst b/changelog/12744.bugfix.rst new file mode 100644 index 0000000000..7814b59c18 --- /dev/null +++ b/changelog/12744.bugfix.rst @@ -0,0 +1 @@ +Fixed typing compatibility with Python 3.9 or less -- replaced `typing.Self` with `typing_extensions.Self` -- by :user:`Avasam` diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index 675f432232..384dea976a 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -44,7 +44,8 @@ if TYPE_CHECKING: import doctest - from typing import Self + + from typing_extensions import Self DOCTEST_REPORT_CHOICE_NONE = "none" DOCTEST_REPORT_CHOICE_CDIFF = "cdiff" diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index bbde2664b9..cc67869584 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -43,7 +43,7 @@ if TYPE_CHECKING: - from typing import Self + from typing_extensions import Self # Imported here due to circular import. from _pytest.main import Session diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 3a8c77fd2f..6507c29922 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -78,7 +78,7 @@ if TYPE_CHECKING: - from typing import Self + from typing_extensions import Self def pytest_addoption(parser: Parser) -> None: