(self, pytester: Pytester, maybe_type: str)
| 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: |
nothing calls this directly
no test coverage detected