I am using Django-Q to send async emails with Django 2.2, DRF 3.9 and Postgres 10.9
The setup works fine except when it comes to unit tests. I refer to the following issue which is the exact same thing I am facing: https://github.com/Koed00/django-q/issues/266
As per the link, one of the solutions was to do change the sync setting to 'True' for testing purposes.
This is what i have in tests.py:
from django.conf import settings
settings.Q_CLUSTER['sync'] = True
class UserAPITestCase(APITransactionTestCase):
print(settings.Q_CLUSTER)
'print' shows that the 'sync':True has been added, but the async_task still runs in async mode.
However if I were to add the sync setting in the settings file directly everything works as it should and the async_task runs synchronously.
It's like django-q isn't taking in the setting if it is updated later. How do I fix that?