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

Method test_getcfg_and_config

testing/test_config.py:43–66  ·  view source on GitHub ↗
(
        self,
        pytester: Pytester,
        tmp_path: Path,
        section: str,
        filename: str,
        monkeypatch: MonkeyPatch,
    )

Source from the content-addressed store, hash-verified

41 "section, filename", [("pytest", "pytest.ini"), ("tool:pytest", "setup.cfg")]
42 )
43 def test_getcfg_and_config(
44 self,
45 pytester: Pytester,
46 tmp_path: Path,
47 section: str,
48 filename: str,
49 monkeypatch: MonkeyPatch,
50 ) -> None:
51 sub = tmp_path / "sub"
52 sub.mkdir()
53 monkeypatch.chdir(sub)
54 (tmp_path / filename).write_text(
55 textwrap.dedent(
56 f"""\
57 [{section}]
58 name = value
59 """
60 ),
61 encoding="utf-8",
62 )
63 _, _, cfg, _ = locate_config(Path.cwd(), [sub])
64 assert cfg["name"] == ConfigValue("value", origin="file", mode="ini")
65 config = pytester.parseconfigure(str(sub))
66 assert config._inicfg["name"] == ConfigValue("value", origin="file", mode="ini")
67
68 def test_setupcfg_uses_toolpytest_with_pytest(self, pytester: Pytester) -> None:
69 p1 = pytester.makepyfile("def test(): pass")

Callers

nothing calls this directly

Calls 6

locate_configFunction · 0.90
ConfigValueClass · 0.90
write_textMethod · 0.80
mkdirMethod · 0.45
chdirMethod · 0.45
parseconfigureMethod · 0.45

Tested by

no test coverage detected