From fb9f277a99c32dbdde251a1df1ae5bc64c4c7de6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 10 Jan 2020 00:50:12 +0100 Subject: [PATCH] Node._repr_failure_py: use abspath with changed cwd Fixes https://github.com/pytest-dev/pytest/issues/6428. --- src/_pytest/nodes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 4a79bc861..61c6bc90a 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -362,8 +362,7 @@ class Node(metaclass=NodeMeta): truncate_locals = True try: - os.getcwd() - abspath = False + abspath = os.getcwd() != str(self.config.invocation_dir) except OSError: abspath = True