Commit 445abf4a authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Force passing a cnx to run_all_tasks()

This has been deprecated for a while, make this mandatory.
parent 1ef783692e79
......@@ -17,7 +17,6 @@
"""cubicweb-celerytask entity's classes"""
import six
import warnings
import celery
from celery.result import AsyncResult, from_serializable
......@@ -43,12 +42,8 @@ def get_tasks():
return _TEST_TASKS.copy()
def run_all_tasks(cnx=None):
def run_all_tasks(cnx):
"""Run all pending tasks (for use in cubicweb test mode)"""
if cnx is None:
warnings.warn('cnx argument should be specified to enable task '
'workflow synchronisation', DeprecationWarning,
results = {}
# run all tasks and gather results.
# Tasks can create other tasks, so run them until there is no one left.
......@@ -56,7 +51,7 @@ def run_all_tasks(cnx=None):
task_eid = list(_TEST_TASKS)[0]
results[task_eid] = _TEST_TASKS.pop(task_eid).delay()
if cnx is not None and celery.current_app.conf.CELERY_ALWAYS_EAGER:
if celery.current_app.conf.CELERY_ALWAYS_EAGER:
for task_eid, result in results.items():
wf = cnx.entity_from_eid(task_eid).cw_adapt_to('IWorkflowable')
transition = {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment