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.
This commit is contained in:
Ran Benita 2021-10-23 21:33:12 +03:00
parent f695e18ddb
commit 853b0a4c29
1 changed files with 3 additions and 3 deletions

View File

@ -210,9 +210,9 @@ class Node(metaclass=NodeMeta):
self.session = parent.session self.session = parent.session
#: Filesystem path where this node was collected from (can be None). #: Filesystem path where this node was collected from (can be None).
self.path = _imply_path_only( if path is None and fspath is None:
path or getattr(parent, "path", None), fspath=fspath path = getattr(parent, "path", None)
) self.path = _imply_path_only(path, fspath=fspath)
# The explicit annotation is to avoid publicly exposing NodeKeywords. # The explicit annotation is to avoid publicly exposing NodeKeywords.
#: Keywords/markers collected from all scopes. #: Keywords/markers collected from all scopes.