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

Method test_addini

testing/test_config.py:614–635  ·  view source on GitHub ↗
(self, pytester: Pytester, maybe_type: str)

Source from the content-addressed store, hash-verified

612
613 @pytest.mark.parametrize("maybe_type", ["not passed", "None", '"string"'])
614 def test_addini(self, pytester: Pytester, maybe_type: str) -> None:
615 if maybe_type == "not passed":
616 type_string = ""
617 else:
618 type_string = f", {maybe_type}"
619
620 pytester.makeconftest(
621 f"""
622 def pytest_addoption(parser):
623 parser.addini("myname", "my new ini value"{type_string})
624 """
625 )
626 pytester.makeini(
627 """
628 [pytest]
629 myname=hello
630 """
631 )
632 config = pytester.parseconfig()
633 val = config.getini("myname")
634 assert val == "hello"
635 pytest.raises(ValueError, config.getini, "other")
636
637 @pytest.mark.parametrize("config_type", ["ini", "pyproject"])
638 def test_addini_paths(self, pytester: Pytester, config_type: str) -> None:

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected