Open
Description
Describe the bug
Hey, pytest flask fixtures are currently incompatible with the newer werkzeug
releases.
self = <FlaskClient <Flask 'click_api.app'>>
args = (<Flask 'click_api.app'>, <class 'pytest_flask.plugin.<class 'pytest_flask.plugin.JSONResponse'>'>)
kwargs = {'use_cookies': True}
def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
super().__init__(*args, **kwargs)
self.preserve_context = False
self._new_contexts: t.List[t.ContextManager[t.Any]] = []
self._context_stack = ExitStack()
self.environ_base = {
"REMOTE_ADDR": "127.0.0.1",
> "HTTP_USER_AGENT": f"werkzeug/{werkzeug.__version__}",
}
E AttributeError: module 'werkzeug' has no attribute '__version__'
__class__ = <class 'flask.testing.FlaskClient'>
args = (<Flask 'click_api.app'>,
<class 'pytest_flask.plugin.<class 'pytest_flask.plugin.JSONResponse'>'>)
kwargs = {'use_cookies': True}
self = <FlaskClient <Flask 'click_api.app'>>
/opt/python/lib/python3.11/site-packages/flask/testing.py:116: AttributeError
To Reproduce
Steps to reproduce the behavior:
- Start a python container via
docker run python:3.11-slim bash
- Install necessary dependencies:
python -m pip install -U pytest-flask requests werkzeug
- Run some tests requiring
client
fixture. E.g. set up minimalistic app according to the package readme and create a test like that:
@pytest.mark.unit
def werk_test(client):
assert client
Expected behavior
Either compatibility with the newest werkzeug
version or pin to an older one.
Environment (please complete the following information):
- Python Version [e.g. 3.8.5]: 3.11
- pytest-flask version:
1.3.0
- werkzeug version:
3.1.3
Thanks a lot! Let me know if I can be any of help.