From 958989fff1d2913ca5de77e8f277c27971683940 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 3eaafa91d5a..74984e83656 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -325,8 +325,7 @@ def _repr_failure_py( truncate_locals = True try: - os.getcwd() - abspath = False + abspath = os.getcwd() != str(self.config.invocation_dir) except OSError: abspath = True