(self, pytester: Pytester, maybe_type: str)
| 841 | |
| 842 | @pytest.mark.parametrize("maybe_type", ["not passed", "None", '"string"']) |
| 843 | def test_addini(self, pytester: Pytester, maybe_type: str) -> None: |
| 844 | if maybe_type == "not passed": |
| 845 | type_string = "" |
| 846 | else: |
| 847 | type_string = f", {maybe_type}" |
| 848 | |
| 849 | pytester.makeconftest( |
| 850 | f""" |
| 851 | def pytest_addoption(parser): |
| 852 | parser.addini("myname", "my new ini value"{type_string}) |
| 853 | """ |
| 854 | ) |
| 855 | pytester.makeini( |
| 856 | """ |
| 857 | [pytest] |
| 858 | myname=hello |
| 859 | """ |
| 860 | ) |
| 861 | config = pytester.parseconfig() |
| 862 | val = config.getini("myname") |
| 863 | assert val == "hello" |
| 864 | with pytest.raises(ValueError): |
| 865 | config.getini("other") |
| 866 | |
| 867 | @pytest.mark.parametrize("config_type", ["ini", "pyproject"]) |
| 868 | def test_addini_paths(self, pytester: Pytester, config_type: str) -> None: |
nothing calls this directly
no test coverage detected