Skip to content

Commit

Permalink
tests: synchroneously execute celery tasks in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Jan 26, 2024
1 parent 7a7770a commit d6384f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/b3desk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def setup_configuration(app, config=None):
app.config.from_object(config_obj)


def setup_celery(app):
from b3desk.tasks import celery

celery.conf.task_always_eager = app.testing


def setup_cache(app):
if app.config.get("CACHE_TYPE"):
config = None
Expand Down Expand Up @@ -156,6 +162,7 @@ def setup_endpoints(app):
def create_app(test_config=None, gunicorn_logging=False):
app = Flask(__name__)
setup_configuration(app, test_config)
setup_celery(app)
setup_cache(app)
setup_logging(app, gunicorn_logging)
setup_i18n(app)
Expand Down

0 comments on commit d6384f0

Please sign in to comment.