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

Function test_addini_paths

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

makeconftestMethod · 0.45
makeiniMethod · 0.45
makepyprojecttomlMethod · 0.45
parseconfigMethod · 0.45
getiniMethod · 0.45

Tested by

no test coverage detected