(pytester: Pytester)
| 200 | |
| 201 | |
| 202 | def test_conftestcutdir(pytester: Pytester) -> None: |
| 203 | conf = pytester.makeconftest("") |
| 204 | p = pytester.mkdir("x") |
| 205 | conftest = PytestPluginManager() |
| 206 | conftest_setinitial(conftest, [pytester.path], confcutdir=p) |
| 207 | conftest._loadconftestmodules( |
| 208 | p, |
| 209 | importmode="prepend", |
| 210 | rootpath=pytester.path, |
| 211 | consider_namespace_packages=False, |
| 212 | ) |
| 213 | values = conftest._getconftestmodules(p) |
| 214 | assert len(values) == 0 |
| 215 | conftest._loadconftestmodules( |
| 216 | conf.parent, |
| 217 | importmode="prepend", |
| 218 | rootpath=pytester.path, |
| 219 | consider_namespace_packages=False, |
| 220 | ) |
| 221 | values = conftest._getconftestmodules(conf.parent) |
| 222 | assert len(values) == 0 |
| 223 | assert not conftest.has_plugin(str(conf)) |
| 224 | # but we can still import a conftest directly |
| 225 | conftest._importconftest( |
| 226 | conf, |
| 227 | importmode="prepend", |
| 228 | rootpath=pytester.path, |
| 229 | consider_namespace_packages=False, |
| 230 | ) |
| 231 | values = conftest._getconftestmodules(conf.parent) |
| 232 | assert values[0].__file__ is not None |
| 233 | assert values[0].__file__.startswith(str(conf)) |
| 234 | # and all sub paths get updated properly |
| 235 | values = conftest._getconftestmodules(p) |
| 236 | assert len(values) == 1 |
| 237 | assert values[0].__file__ is not None |
| 238 | assert values[0].__file__.startswith(str(conf)) |
| 239 | |
| 240 | |
| 241 | def test_conftestcutdir_inplace_considered(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected