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

Function test_override_ini_paths

testing/test_legacypath.py:142–163  ·  view source on GitHub ↗
(pytester: pytest.Pytester)

Source from the content-addressed store, hash-verified

140
141
142def test_override_ini_paths(pytester: pytest.Pytester) -> None:
143 pytester.makeconftest(
144 """
145 def pytest_addoption(parser):
146 parser.addini("paths", "my new ini value", type="pathlist")"""
147 )
148 pytester.makeini(
149 """
150 [pytest]
151 paths=blah.py"""
152 )
153 pytester.makepyfile(
154 r"""
155 def test_overriden(pytestconfig):
156 config_paths = pytestconfig.getini("paths")
157 print(config_paths)
158 for cpf in config_paths:
159 print('\nuser_path:%s' % cpf.basename)
160 """
161 )
162 result = pytester.runpytest("--override-ini", "paths=foo/bar1.py foo/bar2.py", "-s")
163 result.stdout.fnmatch_lines(["user_path:bar1.py", "user_path:bar2.py"])
164
165
166def test_inifile_from_cmdline_main_hook(pytester: pytest.Pytester) -> None:

Callers

nothing calls this directly

Calls 5

fnmatch_linesMethod · 0.80
makeconftestMethod · 0.45
makeiniMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected