(tmp_path, hooktype, request)
| 161 | |
| 162 | @pytest.mark.parametrize("hooktype", ["hook", "ihook"]) |
| 163 | def test_hookproxy_warnings_for_pathlib(tmp_path, hooktype, request): |
| 164 | path = legacy_path(tmp_path) |
| 165 | |
| 166 | PATH_WARN_MATCH = r".*path: py\.path\.local\) argument is deprecated, please use \(collection_path: pathlib\.Path.*" |
| 167 | if hooktype == "ihook": |
| 168 | hooks = request.node.ihook |
| 169 | else: |
| 170 | hooks = request.config.hook |
| 171 | |
| 172 | with pytest.warns(PytestDeprecationWarning, match=PATH_WARN_MATCH) as r: |
| 173 | l1 = sys._getframe().f_lineno |
| 174 | hooks.pytest_ignore_collect( |
| 175 | config=request.config, path=path, collection_path=tmp_path |
| 176 | ) |
| 177 | l2 = sys._getframe().f_lineno |
| 178 | |
| 179 | (record,) = r |
| 180 | assert record.filename == __file__ |
| 181 | assert l1 < record.lineno < l2 |
| 182 | |
| 183 | hooks.pytest_ignore_collect(config=request.config, collection_path=tmp_path) |
| 184 | |
| 185 | # Passing entirely *different* paths is an outright error. |
| 186 | with pytest.raises(ValueError, match=r"path.*fspath.*need to be equal"): |
| 187 | with pytest.warns(PytestDeprecationWarning, match=PATH_WARN_MATCH) as r: |
| 188 | hooks.pytest_ignore_collect( |
| 189 | config=request.config, path=path, collection_path=Path("/bla/bla") |
| 190 | ) |
| 191 | |
| 192 | |
| 193 | def test_warns_none_is_deprecated(): |
nothing calls this directly
no test coverage detected