Fix test failure with Pytest 8.0

Not sure why this didn't fail before the pytest update, but oh well.

Fixes https://github.com/pallets/werkzeug/issues/2845.

Origin: upstream, https://github.com/pallets/werkzeug/issues/2845

Gbp-Pq: Name Fix-test-failure-with-Pytest-8.0.patch
This commit is contained in:
Mohammed Anas 2024-01-29 23:25:20 +00:00 committed by luoyaoming
parent 79eb4006c4
commit 57810cc8c2
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,12 @@
.. currentmodule:: werkzeug
Version 3.0.2
-------------
Unreleased
- Fix test failure with Pytest 8.0. :issue:`2845` :pr:`2846`
Version 3.0.1
-------------

View File

@ -8,6 +8,7 @@ from werkzeug import exceptions
from werkzeug.datastructures import Headers
from werkzeug.datastructures import WWWAuthenticate
from werkzeug.exceptions import HTTPException
from werkzeug.routing import RequestRedirect
from werkzeug.wrappers import Response
@ -163,7 +164,10 @@ def test_description_none():
),
)
def test_response_body(cls):
exc = cls()
if cls == RequestRedirect:
exc = cls("https://example.com")
else:
exc = cls()
response_body = exc.get_body()
assert response_body.startswith("<!doctype html>\n<html lang=en>\n")
assert f"{exc.code} {escape(exc.name)}" in response_body