Test relapth when rootdir != invocationdir.

This commit is contained in:
Katarzyna 2020-05-04 00:04:38 +02:00
parent 402ee6fb9d
commit a5bcd0655f
1 changed files with 20 additions and 0 deletions

View File

@ -1176,3 +1176,23 @@ 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
""",
"tests/sub_tests/test_empty.py": """
pass
""",
}
)
result = testdir.runpytest("-rs", "tests/test_1.py", "--rootdir=tests/sub_tests")
result.stdout.fnmatch_lines(
["SKIPPED [[]1[]] tests/test_1.py:2: unconditional skip"]
)