Skip to content

Commit fb9f277

Browse files
blueyednicoddemus
authored andcommitted
Node._repr_failure_py: use abspath with changed cwd
Fixes #6428.
1 parent 56bf819 commit fb9f277

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/_pytest/nodes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,7 @@ def _repr_failure_py(
362362
truncate_locals = True
363363

364364
try:
365-
os.getcwd()
366-
abspath = False
365+
abspath = os.getcwd() != str(self.config.invocation_dir)
367366
except OSError:
368367
abspath = True
369368

0 commit comments

Comments
 (0)