djblets.testing.testrunners¶
- class TestRunner(*args, **kwargs)[source]¶
Test runner for standard Djblets-based projects.
This class provides all the common setup for settings, databases, and directories that are generally needed by Django projects using Djblets. Much of the behavior can be overridden by subclasses.
nose is used to run the test suites. The options can be configured through
nose_options
.This can be subclassed in order to set the settings for the test run, or it can be instantiated with those settings passed in as keyword arguments.
- nose_options = ['-v', '--match=^test', '--with-id', '--with-doctest', '--doctest-extension=.txt'][source]¶
The options used for nose.
This is a list of command line arguments that would be passed to nosetests.
- setup_test_environment(*args, **kwargs)[source]¶
Set up an environment for the unit tests.
This will handle setting all the default settings for a Djblets-based project and will create the directory structure needed for the tests in a temp directory.
Subclasses can override this to provide additional setup logic.
This must be called before
run_tests()
.
- teardown_test_environment(*args, **kwargs)[source]¶
Tear down the environment for the unit tests.
This will clean up the temp directory structure.It must be called after
run_tests()
.
- run_tests(test_labels=[], argv=None, *args, **kwargs)[source]¶
Run the test suite.
- Parameters
- Returns
The exit code. 0 means all tests passed, while 1 means there were failures.
- Return type
- setup_dirs()[source]¶
Set up directories to create and use.
This can return one or more directory paths that need to be created before the tests can be run. It may also store settings pointing to those paths.
This is not responsible for creating the directories. Any returned paths will be created automatically.
- Returns
A list of directory paths to create.
- Return type
list of unicode