Skip to content

Commit ea1892f

Browse files
committed
Fix non-sensical error message
Introduced in 12de92c / pytest-dev#7698
1 parent 4274af1 commit ea1892f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changelog/9077.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed confusing error message when ``request.fspath`` / ``request.path`` was accessed from a session-scoped fixture.

src/_pytest/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def fspath(self) -> LEGACY_PATH:
536536
@property
537537
def path(self) -> Path:
538538
if self.scope not in ("function", "class", "module", "package"):
539-
raise AttributeError(f"module not available in {self.scope}-scoped context")
539+
raise AttributeError(f"path not available in {self.scope}-scoped context")
540540
# TODO: Remove ignore once _pyfuncitem is properly typed.
541541
return self._pyfuncitem.path # type: ignore
542542

0 commit comments

Comments
 (0)