nose: nose.loader
nose's test loader implements the same basic functionality as its superclass, unittest.TestLoader, but extends it by more liberal interpretations of what may be a test and how a test may be named.
Classes
Highlighted methods are defined in this class.
Test loader that extends unittest.TestLoader to:
- Load tests from test-like functions and classes that are not unittest.TestCase subclasses
- Find and load test modules in a directory
- Support tests that are generators
- Support easy extensions of or changes to that behavior through plugins
Methods
Initialize a test loader.
Parameters (all optional):
- config: provide a nose.config.Config or other config class instance; if not provided a nose.config.Config with default values is used.
- importer: provide an importer instance that implements importFromPath. If not provided, a nose.importer.Importer is used.
- workingDir: the directory to which file and module names are relative. If not provided, assumed to be the current working directory.
- selector: a selector class or instance. If a class is provided, it will be instantiated with one argument, the current config. If not provided, a nose.selector.Selector is used.
Override to select with selector, unless config.getTestCaseNamesCompat is True
Load tests from the directory at path. This is a generator -- each suite of tests from a module or other file is yielded and is expected to be executed before the next file is examined.
Load tests from a non-module file. Default is to raise a ValueError; plugins may implement loadTestsFromFile to provide a list of tests loaded from the file.
Lazy-load tests from a generator function. The generator function may yield either:
- a callable, or
- a function name resolvable within the same module
Lazy-load tests from a generator method.
This is more complicated than loading from a generator function, since a generator method may yield:
- a function
- a bound or unbound method, or
- a method name
Load all tests from module and return a suite containing them. If the module has been discovered and is not test-like, the suite will be empty by default, though plugins may add their own tests.
Load tests from the entity with the given name.
The name may indicate a file, directory, module, or any object within a module. See nose.util.split_test_name for details on test name parsing.
Load tests from all names, returning a suite containing all tests.
Load tests from a unittest.TestCase subclass.
Load tests from a test class that is not a unittest.TestCase subclass.
In this case, we can't depend on the class's __init__ taking method name arguments, so we have to compose a MethodTestCase for each method in the class that looks testlike.
Given a test object and its parent, return a test case or test suite.
Resolve name within module
cmp(x, y) -> integer
Return negative if x<y, zero if x==y, positive if x>y.
Attributes
Default value: None
Default value: None
Default value: None
Default value: None
Default value: test
Default value: None