(pytester: pytest.Pytester, config_type: str)
| 115 | |
| 116 | @pytest.mark.parametrize("config_type", ["ini", "toml"]) |
| 117 | def test_addini_paths(pytester: pytest.Pytester, config_type: str) -> None: |
| 118 | pytester.makeconftest( |
| 119 | """ |
| 120 | def pytest_addoption(parser): |
| 121 | parser.addini("paths", "my new ini value", type="pathlist") |
| 122 | parser.addini("abc", "abc value") |
| 123 | """ |
| 124 | ) |
| 125 | if config_type == "ini": |
| 126 | inipath = pytester.makeini( |
| 127 | """ |
| 128 | [pytest] |
| 129 | paths = hello world/sub.py |
| 130 | """ |
| 131 | ) |
| 132 | else: |
| 133 | inipath = pytester.maketoml( |
| 134 | """ |
| 135 | [pytest] |
| 136 | paths = ["hello", "world/sub.py"] |
| 137 | """ |
| 138 | ) |
| 139 | config = pytester.parseconfig() |
| 140 | values = config.getini("paths") |
| 141 | assert len(values) == 2 |
| 142 | assert values[0] == inipath.parent.joinpath("hello") |
| 143 | assert values[1] == inipath.parent.joinpath("world/sub.py") |
| 144 | with pytest.raises(ValueError): |
| 145 | config.getini("other") |
| 146 | |
| 147 | |
| 148 | def test_override_ini_paths(pytester: pytest.Pytester) -> None: |
nothing calls this directly
no test coverage detected