19 lines
433 B
Python
19 lines
433 B
Python
from dramatiq import Worker, get_broker
|
|
from django.test import TransactionTestCase
|
|
|
|
|
|
class TaskTestCase(TransactionTestCase):
|
|
def _pre_setup(self):
|
|
super()._pre_setup()
|
|
|
|
self.broker = get_broker()
|
|
self.broker.flush_all()
|
|
|
|
self.worker = Worker(self.broker, worker_timeout=100)
|
|
self.worker.start()
|
|
|
|
def _post_teardown(self):
|
|
self.worker.stop()
|
|
|
|
super()._post_teardown()
|