Skip to content

Commit

Permalink
Make the exception tests more robust
Browse files Browse the repository at this point in the history
This should ensure that the tests work with Pytest 8 onwards. The
issue appears to be that __subclasses__ "returns a list of all those
references still alive." which could include the RequestRedirect. If
it does include RequestRedirect the tests will fail as it requires an
argument to be constructed. Note this test is not meant for
RequestRedirect.
  • Loading branch information
pgjones committed Mar 3, 2024
1 parent 70ad4d6 commit 4e5bdca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from werkzeug import exceptions
from werkzeug.datastructures import Headers
from werkzeug.datastructures import WWWAuthenticate
from werkzeug.exceptions import HTTPException
from werkzeug.exceptions import default_exceptions, HTTPException
from werkzeug.wrappers import Response


Expand Down Expand Up @@ -138,7 +138,7 @@ def test_retry_after_mixin(cls, value, expect):
@pytest.mark.parametrize(
"cls",
sorted(
(e for e in HTTPException.__subclasses__() if e.code and e.code >= 400),
(e for e in default_exceptions.values() if e.code and e.code >= 400),
key=lambda e: e.code, # type: ignore
),
)
Expand All @@ -158,7 +158,7 @@ def test_description_none():
@pytest.mark.parametrize(
"cls",
sorted(
(e for e in HTTPException.__subclasses__() if e.code),
(e for e in default_exceptions.values() if e.code),
key=lambda e: e.code, # type: ignore
),
)
Expand Down

0 comments on commit 4e5bdca

Please sign in to comment.