(pytester: Pytester)
| 179 | |
| 180 | |
| 181 | def test_conftestcutdir(pytester: Pytester) -> None: |
| 182 | conf = pytester.makeconftest("") |
| 183 | p = pytester.mkdir("x") |
| 184 | conftest = PytestPluginManager() |
| 185 | conftest_setinitial(conftest, [pytester.path], confcutdir=p) |
| 186 | values = conftest._getconftestmodules( |
| 187 | p, importmode="prepend", rootpath=pytester.path |
| 188 | ) |
| 189 | assert len(values) == 0 |
| 190 | values = conftest._getconftestmodules( |
| 191 | conf.parent, importmode="prepend", rootpath=pytester.path |
| 192 | ) |
| 193 | assert len(values) == 0 |
| 194 | assert Path(conf) not in conftest._conftestpath2mod |
| 195 | # but we can still import a conftest directly |
| 196 | conftest._importconftest(conf, importmode="prepend", rootpath=pytester.path) |
| 197 | values = conftest._getconftestmodules( |
| 198 | conf.parent, importmode="prepend", rootpath=pytester.path |
| 199 | ) |
| 200 | assert values[0].__file__.startswith(str(conf)) |
| 201 | # and all sub paths get updated properly |
| 202 | values = conftest._getconftestmodules( |
| 203 | p, importmode="prepend", rootpath=pytester.path |
| 204 | ) |
| 205 | assert len(values) == 1 |
| 206 | assert values[0].__file__.startswith(str(conf)) |
| 207 | |
| 208 | |
| 209 | def test_conftestcutdir_inplace_considered(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected