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

Incompatibility with werkzeug>=3.1 #197

Open
stancld opened this issue Nov 14, 2024 · 0 comments
Open

Incompatibility with werkzeug>=3.1 #197

stancld opened this issue Nov 14, 2024 · 0 comments
Labels

Comments

@stancld
Copy link

stancld commented Nov 14, 2024

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:

  1. Start a python container via docker run python:3.11-slim bash
  2. Install necessary dependencies: python -m pip install -U pytest-flask requests werkzeug
  3. 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.

@stancld stancld added the bug label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant