pytest-dev / pytest-flask

A set of pytest fixtures to test Flask applications

Home Page:http://pytest-flask.readthedocs.org/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask's _request_ctx_stack is deprecated

ivanovmg opened this issue · comments

Describe the bug
Flask's _request_ctx_stack is deprecated and will be removed in Flask 2.4.
Currently pytest-flask relies on this function in

def request_ctx(app):

To Reproduce
Steps to reproduce the behavior:

$ pip list | grep pytest-flask
pytest-flask                  1.2.0
$ python -W default -m pytest tests
...\venv\lib\site-packages\pytest_flask\fixtures.py:6: DeprecationWarning: '_request_ctx_stack' is deprecated and will be removed in Flask 2.4.
  from flask import _request_ctx_stack

Expected behavior
Need to drop use of _request_ctx_stack to prepare for Flask 2.4 release.

Environment (please complete the following information):

  • OS: Windows 10
  • Python Version 3.10.0
  • pytest-flask version 1.2.0

Flask 3.0.0 and werkzeug 3.0.0 have been released yesterday. pytest-flask fails because of this now.

Therequest_ctx fixture already throws a warning that it's deprecated.

Hi @ivanovmg

The latest released version (1.3.0) fixed the compatibility with Flask 3.0. Thank you for rising up this issue.