Package Biskit :: Module test :: Class BiskitTestLoader
[hide private]
[frames] | no frames]

Class BiskitTestLoader

source code


A replacement for the unittest TestLoaders. It automatically collects all BiskitTests from a whole package (that means a folder with python files).

Instance Methods [hide private]
  __init__(self, log=StdLog(), allowed=[], forbidden=[], verbosity=2, debug=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  modulesFromPath(self, path=T.projectRoot(), module='Biskit')
Import all python files of a package as modules.
  addTestsFromModules(self, modules)
Extract all test cases from a list of python modules and add them to the internal test suite.
  collectTests(self, path=T.projectRoot(), module='Biskit')
Add all BiskitTests found in a given module to the internal test suite.
  __moduleNames(self, modules)
  report(self)
Report how things went to stdout.
  run(self, dry=False)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Instance Variables [hide private]
  modules_untested
list of modules without test cases
  modules_tested
list of modules containing test cases
  result
will hold test result after run()

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, log=StdLog(), allowed=[], forbidden=[], verbosity=2, debug=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Parameters:
  • log (Biskit.LogFile) - log output target [default: Biskit.StdLog]
  • allowed ([ int ]) - tags required for test to be considered, default: []
  • forbidden ([ int ]) - tags leading to the exclusion of test, default: []
  • verbosity (int) - verbosity level for unittest.TextTestRunner
Overrides: object.__init__

modulesFromPath(self, path=T.projectRoot(), module='Biskit')

source code 

Import all python files of a package as modules. Sub-packages are ignored and have to be collected separately.
Parameters:
  • path (str) - single search path for a package
  • module (str) - name of the python package [default: Biskit]
Returns:
list of imported python modules, see also __import__ @rtype : [ module ]
Raises:
  • ImportError - if a python file cannot be imported

addTestsFromModules(self, modules)

source code 

Extract all test cases from a list of python modules and add them to the internal test suite.
Parameters:
  • modules ([ module ]) - list of modules to be checked for BiskitTest classes

collectTests(self, path=T.projectRoot(), module='Biskit')

source code 

Add all BiskitTests found in a given module to the internal test suite.
Parameters:
  • path (str) - single search path for a package
  • module (str) - name of the python package

__moduleNames(self, modules)

source code 

report(self)

source code 

Report how things went to stdout.

run(self, dry=False)

source code 
Parameters:
  • dry (bool) - do not actually run the test but just set it up [False]

Instance Variable Details [hide private]

modules_untested


list of modules without test cases

modules_tested


list of modules containing test cases

result


will hold test result after run()