(
self, tmp_path: Path, monkeypatch: MonkeyPatch
)
| 144 | assert obj.__name__ == "execfile" |
| 145 | |
| 146 | def test_renamed_dir_creates_mismatch( |
| 147 | self, tmp_path: Path, monkeypatch: MonkeyPatch |
| 148 | ) -> None: |
| 149 | tmp_path.joinpath("a").mkdir() |
| 150 | p = tmp_path.joinpath("a", "test_x123.py") |
| 151 | p.touch() |
| 152 | import_path(p, root=tmp_path) |
| 153 | tmp_path.joinpath("a").rename(tmp_path.joinpath("b")) |
| 154 | with pytest.raises(ImportPathMismatchError): |
| 155 | import_path(tmp_path.joinpath("b", "test_x123.py"), root=tmp_path) |
| 156 | |
| 157 | # Errors can be ignored. |
| 158 | monkeypatch.setenv("PY_IGNORE_IMPORTMISMATCH", "1") |
| 159 | import_path(tmp_path.joinpath("b", "test_x123.py"), root=tmp_path) |
| 160 | |
| 161 | # PY_IGNORE_IMPORTMISMATCH=0 does not ignore error. |
| 162 | monkeypatch.setenv("PY_IGNORE_IMPORTMISMATCH", "0") |
| 163 | with pytest.raises(ImportPathMismatchError): |
| 164 | import_path(tmp_path.joinpath("b", "test_x123.py"), root=tmp_path) |
| 165 | |
| 166 | def test_messy_name(self, tmp_path: Path) -> None: |
| 167 | # https://bitbucket.org/hpk42/py-trunk/issue/129 |
nothing calls this directly
no test coverage detected