django-rq
django-rq copied to clipboard
No way to modify RQ_QUEUES during testing
I would like to override RQ_QUEUES
during testing, so that I can use a different Redis instance for testing purposes. (I would also like to make sure this instance is empty for testing, but that's beyond the scope of this issue.)
Overriding RQ_QUEUES
like this does not achieve this:
from django.test import override_settings, TestCase
@override_settings(RQ_QUEUES=None)
class ExampleTestCase(TestCase):
def test_example(self):
# etc
This just runs like the override_settings
decorator had never been applied.
Maybe the solution is to have a subclass of TestCase
that sets up everything as needed for testing?
from django_rq.testing import RqTestCase
class ExampleTestCase(RqTestCase):
def test_example(self):
# etc
Maybe RqTestCase
could also run automatically remaining jobs after every test?
We should probably name it DjangoRQTestCase
but if this makes testing easier, PR is welcome :)