Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated werkzeug import #35

Merged
merged 4 commits into from
Feb 19, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion flask_restx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from jsonschema import RefResolver

from werkzeug import cached_property
from werkzeug.utils import cached_property
from werkzeug.datastructures import Headers
from werkzeug.exceptions import HTTPException, MethodNotAllowed, NotFound, NotAcceptable, InternalServerError
from werkzeug.wrappers import BaseResponse
Expand Down
2 changes: 1 addition & 1 deletion requirements/install.pip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aniso8601>=0.82
jsonschema
Flask>=0.8
werkzeug<=0.16.1
werkzeug
SVilgelm marked this conversation as resolved.
Show resolved Hide resolved
pytz
six>=1.3.0
enum34; python_version < '3.4'
2 changes: 1 addition & 1 deletion requirements/test.pip
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pytest==4.6.5; python_version < '3.5'
pytest==5.0.1; python_version >= '3.5'
pytest-benchmark==3.2.2
pytest-cov==2.7.1
pytest-flask==0.15.0
pytest-flask==0.15.1
SteadBytes marked this conversation as resolved.
Show resolved Hide resolved
pytest-mock==1.10.4
pytest-profiling==1.7.0
pytest-sugar==0.9.2
Expand Down
2 changes: 1 addition & 1 deletion tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def test_handle_non_api_error(self, app, client):

response = client.get("/foo")
assert response.status_code == 404
assert response.headers['Content-Type'] == 'text/html'
assert response.headers['Content-Type'] == 'text/html; charset=utf-8'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the addition of charset here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced by werkzeug 1.0 as well.
Related to pallets/werkzeug#1526

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain this in the commit message @plowman 😄

Copy link
Contributor Author

@plowman plowman Feb 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, I disagree about how useful this information will be for future commit archaeologists but sure, commit message: updated.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks the tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's more complicated than that.

Only one test remains broken: the one running python 3.4
At first, we may think this change breaks the test, but in fact, what is really broken is the fact that werkzeug 1.0 is NOT available for python 3.4 hence the tests are running with an old version of werkzeug which does not insert the charset in the Content-Type header.

The proper fix is to remove python 3.4 from the test suite and completely drop support for python 3.4 (which is EOL for almost a year).


def test_non_api_error_404_catchall(self, app, client):
api = restx.Api(app, catch_all_404s=True)
Expand Down