Skip to content

Commit 131bb3c

Browse files
committed
pytest_httpserver/httpserver.py: make mypy compatible with werkzeug 3.0.0
In werkzeug 3.0.0 they removed the attributes which were previously announced, but mypy complains about this, even if I add hasattr() check. This is the error thrown by mypy: ``` pytest_httpserver/httpserver.py:139: error: Module has no attribute "parse_authorization_header"; maybe "parse_options_header"? ``` I tried with `assert` and `if`, both with getattr and hasattr checks but none of these worked.
1 parent 3304ac2 commit 131bb3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytest_httpserver/httpserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def __init__(self, matchers: Optional[Mapping[str, Callable[[Optional[str], str]
136136
def authorization_header_value_matcher(actual: Optional[str], expected: str) -> bool:
137137
callable = getattr(Authorization, "from_header", None)
138138
if callable is None: # Werkzeug < 2.3.0
139-
callable = werkzeug.http.parse_authorization_header
139+
callable = werkzeug.http.parse_authorization_header # type: ignore[attr-defined]
140140
return callable(actual) == callable(expected)
141141

142142
@staticmethod

0 commit comments

Comments
 (0)