Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/background.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ library added to the requirements, which may cause compatibility issues.
Requirements version restrictions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In general, the package requirements should have no version restrictions. For
example, the *werkzeug* library has no restrictions, which means that if a new
version comes out of it, it is assumed that *pytest-httpserver* will be able to
run with it.
In general, the package requirements should have as few version restrictions
as possible. The *werkzeug* library currently requires *werkzeug >= 3.0.0*, so
new versions of *werkzeug* are assumed to work with *pytest-httpserver*,
but older, unsupported versions are not.

Many people uses this library in an environment having full of other packages
and limiting version here will limit their versions in their requirements also.
Expand Down
6 changes: 1 addition & 5 deletions pytest_httpserver/httpserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from typing import ClassVar
from typing import TypedDict

import werkzeug.http
from werkzeug import Request
from werkzeug import Response
from werkzeug.datastructures import Authorization
Expand Down Expand Up @@ -152,10 +151,7 @@ def __init__(self, matchers: Mapping[str, Callable[[str | None, str], bool]] | N

@staticmethod
def authorization_header_value_matcher(actual: str | None, expected: str) -> bool:
func = getattr(Authorization, "from_header", None)
if func is None: # Werkzeug < 2.3.0
func = werkzeug.http.parse_authorization_header # type: ignore[attr-defined]
return func(actual) == func(expected) # type: ignore
return Authorization.from_header(actual) == Authorization.from_header(expected)

@staticmethod
def default_header_value_matcher(actual: str | None, expected: str) -> bool:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
upgrade:
- |
Support for Werkzeug versions older than 3.0.0 has been removed as
pytest-httpserver now requires ``Werkzeug >= 3.0.0``. The fallback for
the deprecated ``werkzeug.http.parse_authorization_header`` has been
dropped from ``HeaderValueMatcher`` and the documentation has been
updated accordingly.
Loading