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