diff --git a/changelog/13345.bugfix.rst b/changelog/13345.bugfix.rst new file mode 100644 index 00000000000..5010888aa08 --- /dev/null +++ b/changelog/13345.bugfix.rst @@ -0,0 +1 @@ +Fix type hints for :attr:`pytest.TestReport.when` and :attr:`pytest.TestReport.location`. diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index 746512285b4..c85bf78594f 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -260,6 +260,9 @@ class TestReport(BaseReport): """ __test__ = False + + when: Literal["setup", "call", "teardown"] + location: tuple[str, int | None, str] # Defined by skipping plugin. # xfail reason if xfailed, otherwise not defined. Use hasattr to distinguish. wasxfail: str