Skip to content

Commit

Permalink
chore(🤖): bump python "flask==2.3.3" (apache#27657)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored and qleroy committed Apr 28, 2024
1 parent 14ef439 commit 5c83e31
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
4 changes: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ bcrypt==4.0.1
# via paramiko
billiard==4.2.0
# via celery
blinker==1.7.0
# via flask
bottleneck==1.3.7
# via pandas
brotli==1.0.9
Expand Down Expand Up @@ -92,7 +94,7 @@ email-validator==1.1.3
# via flask-appbuilder
exceptiongroup==1.2.0
# via cattrs
flask==2.2.5
flask==2.3.3
# via
# apache-superset
# flask-appbuilder
Expand Down
32 changes: 18 additions & 14 deletions tests/integration_tests/celery_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import pytest

import flask
from flask import current_app
from flask import current_app, has_app_context

from superset import db, sql_lab
from superset.common.db_query_status import QueryStatus
Expand Down Expand Up @@ -473,19 +473,23 @@ def test_create_table_as():


def test_in_app_context():
@celery_app.task()
def my_task():
assert current_app

# Make sure we can call tasks with an app already setup
my_task()

# Make sure the app gets pushed onto the stack properly
try:
popped_app = flask._app_ctx_stack.pop()
my_task()
finally:
flask._app_ctx_stack.push(popped_app)
@celery_app.task(bind=True)
def my_task(self):
# Directly check if an app context is present
return has_app_context()

# Expect True within an app context
with app.app_context():
result = my_task.apply().get()
assert (
result is True
), "Task should have access to current_app within app context"

# Expect True outside of an app context
result = my_task.apply().get()
assert (
result is True
), "Task should have access to current_app outside of app context"


def delete_tmp_view_or_table(name: str, db_object_type: str):
Expand Down

0 comments on commit 5c83e31

Please sign in to comment.