We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cee62af commit bfd801dCopy full SHA for bfd801d
src/_pytest/nodes.py
@@ -360,6 +360,12 @@ def _repr_failure_py(
360
else:
361
truncate_locals = True
362
363
+ # excinfo.getrepr() formats paths relative to the CWD if `abspath` is False.
364
+ # It is possible for a fixture/test to change the CWD while this code runs, which
365
+ # would then result in the user seeing confusing paths in the failure message.
366
+ # To fix this, if the CWD changed, always display the full absolute path.
367
+ # It will be better to just always display paths relative to invocation_dir, but
368
+ # this requires a lot of plumbing (#6428).
369
try:
370
abspath = Path(os.getcwd()) != Path(self.config.invocation_dir)
371
except OSError:
0 commit comments