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

Function test_addini_paths

testing/test_legacypath.py:117–145  ·  view source on GitHub ↗
(pytester: pytest.Pytester, config_type: str)

Source from the content-addressed store, hash-verified

115
116@pytest.mark.parametrize("config_type", ["ini", "toml"])
117def test_addini_paths(pytester: pytest.Pytester, config_type: str) -> None:
118 pytester.makeconftest(
119 """
120 def pytest_addoption(parser):
121 parser.addini("paths", "my new ini value", type="pathlist")
122 parser.addini("abc", "abc value")
123 """
124 )
125 if config_type == "ini":
126 inipath = pytester.makeini(
127 """
128 [pytest]
129 paths = hello world/sub.py
130 """
131 )
132 else:
133 inipath = pytester.maketoml(
134 """
135 [pytest]
136 paths = ["hello", "world/sub.py"]
137 """
138 )
139 config = pytester.parseconfig()
140 values = config.getini("paths")
141 assert len(values) == 2
142 assert values[0] == inipath.parent.joinpath("hello")
143 assert values[1] == inipath.parent.joinpath("world/sub.py")
144 with pytest.raises(ValueError):
145 config.getini("other")
146
147
148def test_override_ini_paths(pytester: pytest.Pytester) -> None:

Callers

nothing calls this directly

Calls 5

maketomlMethod · 0.80
makeconftestMethod · 0.45
makeiniMethod · 0.45
parseconfigMethod · 0.45
getiniMethod · 0.45

Tested by

no test coverage detected