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