Skip to content

Commit 853b0a4

Browse files
committed
nodes: fix bug in Node() fspath compat
Since path <-> fspath are converted to each other, we need to check both before looking at the parent, in case fspath is set but path is not.
1 parent f695e18 commit 853b0a4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/_pytest/nodes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ def __init__(
210210
self.session = parent.session
211211

212212
#: Filesystem path where this node was collected from (can be None).
213-
self.path = _imply_path_only(
214-
path or getattr(parent, "path", None), fspath=fspath
215-
)
213+
if path is None and fspath is None:
214+
path = getattr(parent, "path", None)
215+
self.path = _imply_path_only(path, fspath=fspath)
216216

217217
# The explicit annotation is to avoid publicly exposing NodeKeywords.
218218
#: Keywords/markers collected from all scopes.

0 commit comments

Comments
 (0)