Incorrect paths to tests in output when using multiple test locations and --rootdir
/pytest.ini
#13254
Labels
--rootdir
/pytest.ini
#13254
Description
When running pytest with paths to tests in multiple directories while setting rootdir (or having a pytest.ini file) to one of the test directories, paths to tests from other directories in the output are wrong.
Consider the following file structure:
When running pytest inside
tests/a/
and giving it paths to both tests (./aa ../b/bb
) while having a pytest.ini intests/a/aa
(or setting--rootdir
to./aa
), path to thetest_b.py
in the output is invalid. The only valid path to thetest_b.py
is after the<-
arrow sign, but that can cause quite confusing and invalid-looking output, especially with multiple test locations, long paths, and many tests.Output with the incorrect path:
The
aa\test_b.py::test_b
test path is invalid.pip list
pytest and operating system versions
pytest 8.3.4, Windows 11 Business 24H2 (build 26100.3194)
Minimal example
Minimal example is prepared in this repository: https://github.com/ugomancz/pytest_rootdir_issue
The text was updated successfully, but these errors were encountered: