Test failure lines should use absolute paths if cwd has changed since invocation, so the path is correct (#6428).
(pytester: Pytester)
| 138 | |
| 139 | |
| 140 | def test_failure_with_changed_cwd(pytester: Pytester) -> None: |
| 141 | """ |
| 142 | Test failure lines should use absolute paths if cwd has changed since |
| 143 | invocation, so the path is correct (#6428). |
| 144 | """ |
| 145 | p = pytester.makepyfile( |
| 146 | """ |
| 147 | import os |
| 148 | import pytest |
| 149 | |
| 150 | @pytest.fixture |
| 151 | def private_dir(): |
| 152 | out_dir = 'ddd' |
| 153 | os.mkdir(out_dir) |
| 154 | old_dir = os.getcwd() |
| 155 | os.chdir(out_dir) |
| 156 | yield out_dir |
| 157 | os.chdir(old_dir) |
| 158 | |
| 159 | def test_show_wrong_path(private_dir): |
| 160 | assert False |
| 161 | """ |
| 162 | ) |
| 163 | result = pytester.runpytest() |
| 164 | result.stdout.fnmatch_lines([str(p) + ":*: AssertionError", "*1 failed in *"]) |
nothing calls this directly
no test coverage detected