csernazs / pytest-httpserver

Http server for pytest to test http clients
MIT License
219 stars 29 forks source link

`werkzeug.urls` deprecation warnings with Werkzeug 2.3.0 #242

Closed The-Compiler closed 1 year ago

The-Compiler commented 1 year ago

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:

https://github.com/csernazs/pytest-httpserver/blob/1df798a207f06772dc46a765d108a6edb0ab3f9b/pytest_httpserver/httpserver.py#L219

csernazs commented 1 year ago

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

Zsolt

csernazs commented 1 year ago

This has been published with version 1.0.7.