diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index b048f466b28..15ef3b05538 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -424,7 +424,7 @@ def module(self): return self._pyfuncitem.getparent(_pytest.python.Module).obj @scopeproperty() - def fspath(self): + def fspath(self) -> py.path.local: """ the file system path of the test module which collected this test. """ return self._pyfuncitem.fspath diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index bb89b691ba3..e935dc35029 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -456,7 +456,7 @@ def add_report_section(self, when: str, key: str, content: str) -> None: if content: self._report_sections.append((when, key, content)) - def reportinfo(self) -> Tuple[str, Optional[int], str]: + def reportinfo(self) -> Tuple[Union[py.path.local, str], Optional[int], str]: return self.fspath, None, "" @cached_property diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index ad63e21a902..215c1c3e7c9 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -114,7 +114,7 @@ def capstderr(self): skipped = property(lambda x: x.outcome == "skipped") @property - def fspath(self): + def fspath(self) -> str: return self.nodeid.split("::")[0] @property