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

Method test_addini_paths

testing/test_config.py:868–896  ·  view source on GitHub ↗
(self, pytester: Pytester, config_type: str)

Source from the content-addressed store, hash-verified

866
867 @pytest.mark.parametrize("config_type", ["ini", "pyproject"])
868 def test_addini_paths(self, pytester: Pytester, config_type: str) -> None:
869 pytester.makeconftest(
870 """
871 def pytest_addoption(parser):
872 parser.addini("paths", "my new ini value", type="paths")
873 parser.addini("abc", "abc value")
874 """
875 )
876 if config_type == "ini":
877 inipath = pytester.makeini(
878 """
879 [pytest]
880 paths=hello world/sub.py
881 """
882 )
883 elif config_type == "pyproject":
884 inipath = pytester.makepyprojecttoml(
885 """
886 [tool.pytest.ini_options]
887 paths=["hello", "world/sub.py"]
888 """
889 )
890 config = pytester.parseconfig()
891 values = config.getini("paths")
892 assert len(values) == 2
893 assert values[0] == inipath.parent.joinpath("hello")
894 assert values[1] == inipath.parent.joinpath("world/sub.py")
895 with pytest.raises(ValueError):
896 config.getini("other")
897
898 def make_conftest_for_args(self, pytester: Pytester) -> None:
899 pytester.makeconftest(

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