- class TestRunner(*args, **kwargs)¶
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.
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.
- __init__(*args, **kwargs)¶
Initialize the test runner.
The caller can override any of the options otherwise defined on the class.
- nose_options = ['-v', '--match=^test', '--with-id', '--with-doctest', '--doctest-extension=.txt']¶
The options used for nose.
This is a list of command line arguments that would be passed to nosetests.
- test_packages = ¶
A list of Python package/module names to test.
- needs_collect_static = True¶
Whether or not
collectstaticneeds to be run before tests.
- setup_test_environment(*args, **kwargs)¶
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
- teardown_test_environment(*args, **kwargs)¶
Tear down the environment for the unit tests.
This will clean up the temp directory structure.It must be called after
- run_tests(test_labels=, argv=None, *args, **kwargs)¶
Run the test suite.
The exit code. 0 means all tests passed, while 1 means there were failures.
- Return type
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.
Run the unit tests using nose.
This will use nose to run the tests, storing the result.
The result from the run.
- Return type