TST: add a regression test for issue 11872

This commit is contained in:
Clément Robert 2024-01-29 09:22:32 +01:00 committed by Ran Benita
parent cb57bf50b1
commit 797c8be4ca
1 changed files with 8 additions and 0 deletions

View File

@ -1450,3 +1450,11 @@ def test_issue_9765(pytester: Pytester) -> None:
raise AssertionError( raise AssertionError(
f"pytest command failed:\n{exc.stdout=!s}\n{exc.stderr=!s}" f"pytest command failed:\n{exc.stdout=!s}\n{exc.stderr=!s}"
) from exc ) from exc
def test_issue_11872():
# see https://github.com/pytest-dev/pytest/issues/11872
from urllib.error import HTTPError
with pytest.raises(HTTPError, match="Not Found"):
raise HTTPError(code=404, msg="Not Found", fp=None, hdrs=None, url="") # type: ignore [arg-type]