Attributes
- testfile_patterns
testfile_patterns = [ 'test_%(modulename)s.py' ]
Method summary
- __init__(self, package = None)
- check_testcase_name(self, name)
- get_testfile(self, module, verbosity = 0)
- info(self, message)
- rename(self, kws)
- run(self)
- test(self, level = 1, verbosity = 1)
- testall(self, level = 1, verbosity = 1)
- warn(self, message)
Methods
- __init__(self, package = None)
- check_testcase_name(self, name)
Return True if name matches TestCase class.
- get_testfile(self, module, verbosity = 0)
Return path to module test file.
- info(self, message)
- rename(self, kws)
Apply renaming submodule test file test_<name>.py to test_<newname>.py. Usage: self.rename(name='newname') before calling self.test() method. If 'newname' is None, then no tests will be executed for a given module.
- run(self)
Run Numpy module test suite with level and verbosity taken from sys.argv. Requires optparse module.
- test(self, level = 1, verbosity = 1)
Run Numpy module test suite with level and verbosity. level: None --- do nothing, return None < 0 --- scan for tests of level=abs(level), don't run them, return TestSuite-list > 0 --- scan for tests of level, run them, return TestRunner verbosity: >= 0 --- show information messages > 1 --- show warnings on missing tests It is assumed that package tests suite follows the following convention: for each package module, there exists file <packagepath>/tests/test_<modulename>.py that defines TestCase classes (with names having prefix 'test_') with methods (with names having prefixes 'check_' or 'bench_'); each of these methods are called when running unit tests. - testall(self, level = 1, verbosity = 1)
Run Numpy module test suite with level and verbosity. level: None --- do nothing, return None < 0 --- scan for tests of level=abs(level), don't run them, return TestSuite-list > 0 --- scan for tests of level, run them, return TestRunner verbosity: >= 0 --- show information messages > 1 --- show warnings on missing tests Different from .test(..) method, this method looks for TestCase classes from all files in <packagedir>/tests/ directory and no assumptions are made for naming the TestCase classes or their methods. - warn(self, message)
