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

Method test_getcfg_and_config

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

locate_configFunction · 0.90
mkdirMethod · 0.45
chdirMethod · 0.45
formatMethod · 0.45
parseconfigureMethod · 0.45

Tested by

no test coverage detected