MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_conftest_import_order

Function test_conftest_import_order

testing/test_conftest.py:379–396  ·  view source on GitHub ↗
(pytester: Pytester, monkeypatch: MonkeyPatch)

Source from the content-addressed store, hash-verified

377
378
379def test_conftest_import_order(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
380 ct1 = pytester.makeconftest("")
381 sub = pytester.mkdir("sub")
382 ct2 = sub / "conftest.py"
383 ct2.write_text("")
384
385 def impct(p, importmode, root):
386 return p
387
388 conftest = PytestPluginManager()
389 conftest._confcutdir = pytester.path
390 monkeypatch.setattr(conftest, "_importconftest", impct)
391 mods = cast(
392 List[Path],
393 conftest._getconftestmodules(sub, importmode="prepend", rootpath=pytester.path),
394 )
395 expected = [ct1, ct2]
396 assert mods == expected
397
398
399def test_fixture_dependency(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 5

_getconftestmodulesMethod · 0.95
PytestPluginManagerClass · 0.90
setattrMethod · 0.80
makeconftestMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected