(
self, tmp_path: Path, monkeypatch: MonkeyPatch, ns_param: bool
)
| 204 | ) |
| 205 | |
| 206 | def test_renamed_dir_creates_mismatch( |
| 207 | self, tmp_path: Path, monkeypatch: MonkeyPatch, ns_param: bool |
| 208 | ) -> None: |
| 209 | tmp_path.joinpath(class="st">"a").mkdir() |
| 210 | p = tmp_path.joinpath(class="st">"a", class="st">"test_x123.py") |
| 211 | p.touch() |
| 212 | import_path(p, root=tmp_path, consider_namespace_packages=ns_param) |
| 213 | tmp_path.joinpath(class="st">"a").rename(tmp_path.joinpath(class="st">"b")) |
| 214 | with pytest.raises(ImportPathMismatchError): |
| 215 | import_path( |
| 216 | tmp_path.joinpath(class="st">"b", class="st">"test_x123.py"), |
| 217 | root=tmp_path, |
| 218 | consider_namespace_packages=ns_param, |
| 219 | ) |
| 220 | |
| 221 | class="cm"># Errors can be ignored. |
| 222 | monkeypatch.setenv(class="st">"PY_IGNORE_IMPORTMISMATCH", class="st">"1") |
| 223 | import_path( |
| 224 | tmp_path.joinpath(class="st">"b", class="st">"test_x123.py"), |
| 225 | root=tmp_path, |
| 226 | consider_namespace_packages=ns_param, |
| 227 | ) |
| 228 | |
| 229 | class="cm"># PY_IGNORE_IMPORTMISMATCH=0 does not ignore error. |
| 230 | monkeypatch.setenv(class="st">"PY_IGNORE_IMPORTMISMATCH", class="st">"0") |
| 231 | with pytest.raises(ImportPathMismatchError): |
| 232 | import_path( |
| 233 | tmp_path.joinpath(class="st">"b", class="st">"test_x123.py"), |
| 234 | root=tmp_path, |
| 235 | consider_namespace_packages=ns_param, |
| 236 | ) |
| 237 | |
| 238 | def test_messy_name(self, tmp_path: Path, ns_param: bool) -> None: |
| 239 | class="cm"># https://bitbucket.org/hpk42/py-trunk/issue/129 |
nothing calls this directly
no test coverage detected