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

Method test_addini_paths

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

Source from the content-addressed store, hash-verified

636
637 @pytest.mark.parametrize("config_type", ["ini", "pyproject"])
638 def test_addini_paths(self, pytester: Pytester, config_type: str) -> None:
639 pytester.makeconftest(
640 """
641 def pytest_addoption(parser):
642 parser.addini("paths", "my new ini value", type="paths")
643 parser.addini("abc", "abc value")
644 """
645 )
646 if config_type == "ini":
647 inipath = pytester.makeini(
648 """
649 [pytest]
650 paths=hello world/sub.py
651 """
652 )
653 elif config_type == "pyproject":
654 inipath = pytester.makepyprojecttoml(
655 """
656 [tool.pytest.ini_options]
657 paths=["hello", "world/sub.py"]
658 """
659 )
660 config = pytester.parseconfig()
661 values = config.getini("paths")
662 assert len(values) == 2
663 assert values[0] == inipath.parent.joinpath("hello")
664 assert values[1] == inipath.parent.joinpath("world/sub.py")
665 pytest.raises(ValueError, config.getini, "other")
666
667 def make_conftest_for_args(self, pytester: Pytester) -> None:
668 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