Skip to content

Commit e211d6f

Browse files
authored
Merge pull request #6488 from blueyed/typing-fix-reportinfo
typing: Node.reportinfo: might return py.path.local via fspath
2 parents 2cce026 + 4a42dee commit e211d6f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/_pytest/fixtures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def module(self):
424424
return self._pyfuncitem.getparent(_pytest.python.Module).obj
425425

426426
@scopeproperty()
427-
def fspath(self):
427+
def fspath(self) -> py.path.local:
428428
""" the file system path of the test module which collected this test. """
429429
return self._pyfuncitem.fspath
430430

src/_pytest/nodes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def add_report_section(self, when: str, key: str, content: str) -> None:
456456
if content:
457457
self._report_sections.append((when, key, content))
458458

459-
def reportinfo(self) -> Tuple[str, Optional[int], str]:
459+
def reportinfo(self) -> Tuple[Union[py.path.local, str], Optional[int], str]:
460460
return self.fspath, None, ""
461461

462462
@cached_property

src/_pytest/reports.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def capstderr(self):
114114
skipped = property(lambda x: x.outcome == "skipped")
115115

116116
@property
117-
def fspath(self):
117+
def fspath(self) -> str:
118118
return self.nodeid.split("::")[0]
119119

120120
@property

0 commit comments

Comments
 (0)