chore(🤖): bump python "flask==2.3.3" (#27657)

This commit is contained in:
Maxime Beauchemin 2024-03-26 12:18:36 -07:00 committed by GitHub
parent 28cbedb82f
commit 12921e6ec3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View File

@ -30,6 +30,8 @@ bcrypt==4.0.1
# via paramiko # via paramiko
billiard==4.2.0 billiard==4.2.0
# via celery # via celery
blinker==1.7.0
# via flask
bottleneck==1.3.7 bottleneck==1.3.7
# via pandas # via pandas
brotli==1.0.9 brotli==1.0.9
@ -92,7 +94,7 @@ email-validator==1.1.3
# via flask-appbuilder # via flask-appbuilder
exceptiongroup==1.2.0 exceptiongroup==1.2.0
# via cattrs # via cattrs
flask==2.2.5 flask==2.3.3
# via # via
# apache-superset # apache-superset
# flask-appbuilder # flask-appbuilder

View File

@ -30,7 +30,7 @@ from tests.integration_tests.fixtures.birth_names_dashboard import (
import pytest import pytest
import flask import flask
from flask import current_app from flask import current_app, has_app_context
from superset import db, sql_lab from superset import db, sql_lab
from superset.common.db_query_status import QueryStatus from superset.common.db_query_status import QueryStatus
@ -473,19 +473,23 @@ def test_create_table_as():
def test_in_app_context(): def test_in_app_context():
@celery_app.task() @celery_app.task(bind=True)
def my_task(): def my_task(self):
assert current_app # Directly check if an app context is present
return has_app_context()
# Make sure we can call tasks with an app already setup # Expect True within an app context
my_task() with app.app_context():
result = my_task.apply().get()
assert (
result is True
), "Task should have access to current_app within app context"
# Make sure the app gets pushed onto the stack properly # Expect True outside of an app context
try: result = my_task.apply().get()
popped_app = flask._app_ctx_stack.pop() assert (
my_task() result is True
finally: ), "Task should have access to current_app outside of app context"
flask._app_ctx_stack.push(popped_app)
def delete_tmp_view_or_table(name: str, db_object_type: str): def delete_tmp_view_or_table(name: str, db_object_type: str):