Skip to content

Commit 6393893

Browse files
WIP: fix relative path finding when parent.path == self.path
1 parent 436932e commit 6393893

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/_pytest/nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,9 @@ def __init__(
536536
) -> None:
537537
path, fspath = _imply_path(path, fspath=fspath)
538538
name = fspath.basename
539-
if parent is not None:
539+
if parent is not None and parent.path != path:
540540
try:
541-
rel = Path(fspath).relative_to(parent.path)
541+
rel = path.relative_to(parent.path)
542542
except ValueError:
543543
pass
544544
else:

0 commit comments

Comments
 (0)