csernazs/pytest-httpserver

`werkzeug.urls` deprecation warnings with Werkzeug 2.3.0

The-Compiler opened this issue · 2 comments

Werkzeug 2.3.0 has deprecated most of the werkzeug.urls module:

Due to that, running something like:

import requests

def test_httpserver(httpserver):
    query = {"k": "v"}
    httpserver.expect_request("/", query_string=query).respond_with_data("OK")
    res = requests.get(httpserver.url_for("/"), params=query)
    res.raise_for_status()

now results in warnings:

mocking/test_httpserver_minimal.py::test_httpserver
  .../site-packages/pytest_httpserver/httpserver.py:216: DeprecationWarning: 'werkzeug.urls.url_decode' is deprecated and will be removed in Werkzeug 2.4. Use 'urllib.parse.parse_qs' instead.
    query = werkzeug.urls.url_decode(request_query_string)

mocking/test_httpserver_minimal.py::test_httpserver
  .../site-packages/werkzeug/urls.py:1195: DeprecationWarning: 'werkzeug.urls.url_unquote_plus' is deprecated and will be removed in Werkzeug 2.4. Use 'urllib.parse.unquote_plus' instead.
    url_unquote_plus(key, charset, errors),

mocking/test_httpserver_minimal.py::test_httpserver
  .../site-packages/werkzeug/urls.py:1196: DeprecationWarning: 'werkzeug.urls.url_unquote_plus' is deprecated and will be removed in Werkzeug 2.4. Use 'urllib.parse.unquote_plus' instead.
    url_unquote_plus(value, charset, errors),

coming from here:

query = werkzeug.urls.url_decode(request_query_string)

Thanks for the issue! I think I will have time to fix it tomorrow.

Zsolt

This has been published with version 1.0.7.