Reputation: 73
i try to override DJango 1.6 custom testrunner, i want to override the teardown_database and teardown_test methods to avoid deletion of test data (i want to look inside the db...):
#!/usr/bin/env python
from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
class KeepDBTestRunner(DjangoTestSuiteRunner):
def teardown_databases(self, old_config, **kwargs):
pass
def teardown_test_environment(self, **kwargs):
pass
But when i run the manage.py test with testrunner with --testrunner option i get:
Creating test database for alias 'default'
...
Ran 230 tests in 1.364s
Without custom testrunner it run only the 3 test that i have wrote.
What's wrong with my custom testrunner, i override a simple method but seems that system run another test set....
Thanks.
Upvotes: 4
Views: 3652
Reputation: 2797
Another way you can do this is by pointing Django at your custom test runner class by setting the TEST_RUNNER
variable in settings.py
e.g.
TEST_RUNNER = 'mymodule.KeepDBTestRunner'
see https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-TEST_RUNNER
Upvotes: 1