test.runner.DiscoverRunner.teardown_databases()

DiscoverRunner.teardown_databases(old_config, **kwargs) Destroys the test databases, restoring pre-test conditions. old_config is a data structure defining the changes in the database configuration that need to be reversed. It is the return value of the setup_databases() method.

test.runner.DiscoverRunner.suite_result()

DiscoverRunner.suite_result(suite, result, **kwargs) Computes and returns a return code based on a test suite, and the result from that test suite.

test.runner.DiscoverRunner.setup_test_environment()

DiscoverRunner.setup_test_environment(**kwargs) Sets up the test environment by calling setup_test_environment() and setting DEBUG to False.

test.runner.DiscoverRunner.setup_databases()

DiscoverRunner.setup_databases(**kwargs) Creates the test databases. Returns a data structure that provides enough detail to undo the changes that have been made. This data will be provided to the teardown_databases() function at the conclusion of testing.

test.runner.DiscoverRunner.run_tests()

DiscoverRunner.run_tests(test_labels, extra_tests=None, **kwargs) Run the test suite. test_labels allows you to specify which tests to run and supports several formats (see DiscoverRunner.build_suite() for a list of supported formats). extra_tests is a list of extra TestCase instances to add to the suite that is executed by the test runner. These extra tests are run in addition to those discovered in the modules listed in test_labels. This method should return the number of tests that failed

test.runner.DiscoverRunner.run_suite()

DiscoverRunner.run_suite(suite, **kwargs) Runs the test suite. Returns the result produced by the running the test suite.

test.runner.DiscoverRunner.build_suite()

DiscoverRunner.build_suite(test_labels, extra_tests=None, **kwargs) Constructs a test suite that matches the test labels provided. test_labels is a list of strings describing the tests to be run. A test label can take one of four forms: path.to.test_module.TestCase.test_method – Run a single test method in a test case. path.to.test_module.TestCase – Run all the test methods in a test case. path.to.module – Search for and run all tests in the named Python package or module. path/to/direct

test.runner.DiscoverRunner

class DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_sql=False, **kwargs) DiscoverRunner will search for tests in any file matching pattern. top_level can be used to specify the directory containing your top-level Python modules. Usually Django can figure this out automatically, so it’s not necessary to specify this option. If specified, it should generally be the directory containing your manage.py file. v

test.Response.wsgi_request

wsgi_request The WSGIRequest instance generated by the test handler that generated the response.

test.Response.templates

templates A list of Template instances used to render the final content, in the order they were rendered. For each template in the list, use template.name to get the template’s file name, if the template was loaded from a file. (The name is a string such as 'admin/index.html'.) Not using Django templates? This attribute is only populated when using the DjangoTemplates backend. If you’re using another template engine, template_name may be a suitable alternative if you only need the name of t