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/directory – Search for and run all tests below the named directory.

If test_labels has a value of None, the test runner will search for tests in all files below the current directory whose names match its pattern (see above).

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.

Returns a TestSuite instance ready to be run.

doc_Django
2016-10-09 18:40:01
Comments
Leave a Comment

Please login to continue.