Commit 3a9e97b4 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Make test celery worker args configurable on test class

parent cb4dded78c74
...@@ -31,6 +31,7 @@ from cubicweb_celerytask.ccplugin import CeleryMonitorCommand ...@@ -31,6 +31,7 @@ from cubicweb_celerytask.ccplugin import CeleryMonitorCommand
class BaseCeleryTaskTC(testlib.CubicWebTC): class BaseCeleryTaskTC(testlib.CubicWebTC):
worker_args = ['-P', 'solo', '-c', '1', '-l', 'info']
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
...@@ -60,11 +61,11 @@ class BaseCeleryTaskTC(testlib.CubicWebTC): ...@@ -60,11 +61,11 @@ class BaseCeleryTaskTC(testlib.CubicWebTC):
cls.worker.terminate() cls.worker.terminate()
cls.worker.join() cls.worker.join()
@staticmethod @classmethod
def start_worker(): def start_worker(cls):
app = celery.current_app app = celery.current_app
worker = celery_worker(app) worker = celery_worker(app)
worker.run_from_argv("worker", ['-P', 'solo', '-c', '1', '-l', 'info']) worker.run_from_argv("worker", cls.worker_args)
def wait_async_task(self, cnx, task_id, timeout=5): def wait_async_task(self, cnx, task_id, timeout=5):
result = celery.result.AsyncResult(task_id) result = celery.result.AsyncResult(task_id)
......
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