MCPcopy
hub / github.com/pytest-dev/pytest / test_conftest_import_order

Function test_conftest_import_order

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

Source from the content-addressed store, hash-verified

463
464
465def test_conftest_import_order(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
466 ct1 = pytester.makeconftest("")
467 sub = pytester.mkdir("sub")
468 ct2 = sub / "conftest.py"
469 ct2.write_text("", encoding="utf-8")
470
471 def impct(p, importmode, root, consider_namespace_packages):
472 return p
473
474 conftest = PytestPluginManager()
475 conftest._confcutdir = pytester.path
476 monkeypatch.setattr(conftest, "_importconftest", impct)
477 conftest._loadconftestmodules(
478 sub,
479 importmode="prepend",
480 rootpath=pytester.path,
481 consider_namespace_packages=False,
482 )
483 mods = cast(list[Path], conftest._getconftestmodules(sub))
484 expected = [ct1, ct2]
485 assert mods == expected
486
487
488def test_fixture_dependency(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected