Merge pull request #7158 from CarycaKatarzyna/issue_7076
This commit is contained in:
commit
9657798c12
|
@ -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.
|
|
@ -168,8 +168,8 @@ def pytest_runtest_makereport(item, call):
|
|||
# to point to the item definition, otherwise it will display
|
||||
# the location of where the skip exception was raised within pytest
|
||||
_, _, reason = rep.longrepr
|
||||
filename, line = item.location[:2]
|
||||
rep.longrepr = filename, line + 1, reason
|
||||
filename, line = item.reportinfo()[:2]
|
||||
rep.longrepr = str(filename), line + 1, reason
|
||||
|
||||
|
||||
# called by terminalreporter progress reporting
|
||||
|
|
|
@ -1176,3 +1176,20 @@ def test_importorskip():
|
|||
match="^could not import 'doesnotexist': No module named .*",
|
||||
):
|
||||
pytest.importorskip("doesnotexist")
|
||||
|
||||
|
||||
def test_relpath_rootdir(testdir):
|
||||
testdir.makepyfile(
|
||||
**{
|
||||
"tests/test_1.py": """
|
||||
import pytest
|
||||
@pytest.mark.skip()
|
||||
def test_pass():
|
||||
pass
|
||||
""",
|
||||
}
|
||||
)
|
||||
result = testdir.runpytest("-rs", "tests/test_1.py", "--rootdir=tests")
|
||||
result.stdout.fnmatch_lines(
|
||||
["SKIPPED [[]1[]] tests/test_1.py:2: unconditional skip"]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue