In order to run my tests faster I created a no db test runner as in this answer. Then I needed to set the TEST_RUNNER
settings variable to my new test runner but only for certain tests. To achieve this, I tried using django.test.utils.override_settings
decorator like this (as in the docs):
from django.test import TestCase
from django.test.utils import override_settings
class MyTestCase(TestCase):
@override_settings(TEST_RUNNER='path_to_my_no_db_test_runner')
def test_my_test_case(self):
...
The problem is that when I run this test, django will still create the database, which is not the expected behavior of course. The curious thing is that if I set the TEST_RUNNER
directly in my settings.py
it works perfectly, but with django.test.utils.override_settings
it seems to have no effect. I also tried using this override_settings module but got the same results.
What am I dping wrong? Is there any other way of achieving this? I'd rather not to create a test_settings.py
and run my tests with --settings
argument.