mateuszb mateuszb - 5 months ago 36
Python Question

Can't invoke celery task in Django tests synchronously

I'd like to invoke celery tasks synchronously during my Django tests without need to run celery worker. To achieve this I have specified

in my but it doesn't seem to work. So I decided to apply override_settings decorator to specific test that looks like this

@override_settings(CELERY_ALWAYS_EAGER=True, BROKER_BACKEND='memory',
def test_foo(self):

Unfortunately, this test still invokes task in my celery worker. What I can be missing? To be specific, I'm using Django 1.10 with Celery 4.0.0.


In celery 4.0 configuration parameters has changed,

Try these instead in your tests,


I was facing same issue, solved using new lowercase names for tests as well as in default celery settings.

Here is new settings to original settings map,

Celery settings change info: