TestCenter Reference
TestSupport.UnitTestDiscovery Namespace Reference

Functions

 getSuiteFromPackage (unitTestRootPackage, pattern="test*.py")
 Creates a Test Suite from all the tests inside a python package which is located in the MeVisLab Repository.
 _getTopLevelDir (searchPath)
 getSuiteFromFolder (searchPath, pattern="*.py")
 Creates a Test Suite from all the tests inside a folder, this could be a TestCenter TestCase folder.

Function Documentation

◆ _getTopLevelDir()

TestSupport.UnitTestDiscovery._getTopLevelDir ( searchPath)
protected

Definition at line 41 of file UnitTestDiscovery.py.

Referenced by getSuiteFromPackage().

◆ getSuiteFromFolder()

TestSupport.UnitTestDiscovery.getSuiteFromFolder ( searchPath,
pattern = "*.py" )

Creates a Test Suite from all the tests inside a folder, this could be a TestCenter TestCase folder.

:param searchPath: the folder where to search for the unit tests. :param pattern: Only test files that match the pattern will be loaded.

Definition at line 47 of file UnitTestDiscovery.py.

◆ getSuiteFromPackage()

TestSupport.UnitTestDiscovery.getSuiteFromPackage ( unitTestRootPackage,
pattern = "test*.py" )

Creates a Test Suite from all the tests inside a python package which is located in the MeVisLab Repository.

Example usage inside a MeVisLab TestCenter Test:

from TestSupport.UnitTestDiscovery import getSuiteFromPackage import my_module.core.tests

def UNITTEST_My_Module(): return getSuiteFromPackage(my_module.core.tests)

:param unitTestRootPackage: the python package in which unit tests are searched :type unitTestRootPackage: ModuleType :param pattern: Only test files that match the pattern will be loaded.

More details can be found in the documentation of the TestLoader.discover() function.

Definition at line 15 of file UnitTestDiscovery.py.

References _getTopLevelDir().