From 402ee6fb9da7eb5e5d702b7794fb0ff6573816fc Mon Sep 17 00:00:00 2001 From: Katarzyna Date: Sun, 3 May 2020 22:56:38 +0200 Subject: [PATCH] Relative path to invocationdir instead rootdir. --- changelog/7076.trivial.rst | 1 + src/_pytest/skipping.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog/7076.trivial.rst diff --git a/changelog/7076.trivial.rst b/changelog/7076.trivial.rst new file mode 100644 index 000000000..5d9749c69 --- /dev/null +++ b/changelog/7076.trivial.rst @@ -0,0 +1 @@ +The path of file skipped by ``@pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. diff --git a/src/_pytest/skipping.py b/src/_pytest/skipping.py index fe8742c66..22e51bc4b 100644 --- a/src/_pytest/skipping.py +++ b/src/_pytest/skipping.py @@ -169,6 +169,7 @@ def pytest_runtest_makereport(item, call): # the location of where the skip exception was raised within pytest _, _, reason = rep.longrepr filename, line = item.location[:2] + filename = item.config.rootdir.join(filename) rep.longrepr = filename, line + 1, reason