|
TestCenter Reference
|
Tools for running MeVisLab tests as Python unit tests. More...
Classes | |
| class | MeVisLabTestCase |
Functions | |
| skippedDummyTest (_) | |
| addTestsToMeVisLabTestCase (globals) | |
| writeTestCenterConfigFile (configFilename, executablePath="", resultDirectory="", reportDirectory="") | |
| _getEnvironmentForTestCenter (mlabroot) | |
| _stripTags (s) | |
| Strips HTML tags from the given string. | |
Variables | |
| mlabroot = os.environ.get("MLAB_ROOT") | |
| NormalTestRegExp = re.compile(r"^(?:DISABLED_)?TEST(\d*_\w+)$") | |
| IterativeTestRegExp = re.compile(r"^(?:DISABLED_)?ITERATIVETEST(\d*_\w+)$") | |
| _stripTagsRE = re.compile(r"(<!--.*?-->|<[^>]*>)") | |
Tools for running MeVisLab tests as Python unit tests.
The functions, decorators and classes defined in this module allow you to wrap your MeVisLab FunctionalTestCase in a unittest.TestCase so that the test case can be executed using the standard Python unit testing framework.
To wrap a FunctionalTestCase in a unittest.TestCase add the following at the end of the test case file.
from TestSupport import PythonUnitTest
@PythonUnitTest.addTestsToMeVisLabTestCase(globals()) class NameOfFunctionalTestCase(PythonUnitTest.MeVisLabTestCase): pass
The above is sufficient to allow PyCharm(TM) to run your MeVisLab functional tests as any other Python unit tests.
If you also want to run your tests from the command line, then, additionally, add the following at the end of the file with the MeVisLab tests (just as for any old Python unit test).
if name == 'main': import unittest unittest.main()
if __file__:
# use __file__ if running outside of MeVisLab (where Base.getDataDirectory() doesn't work)
dataDirectory = os.path.join(os.path.dirname(__file__), 'Data')
else:
# use Base.getDataDirectory() if running in MeVisLab (where __file__ is not set)
dataDirectory = Base.getDataDirectory()
|
protected |
Definition at line 240 of file PythonUnitTest.py.
Referenced by TestSupport.PythonUnitTest.MeVisLabTestCase.setUpClass().
|
protected |
Strips HTML tags from the given string.
Warning: This function is not fool-proof. It is only meant to handle well-formed HTML in MeVisLab log messages.
Definition at line 271 of file PythonUnitTest.py.
Referenced by TestSupport.PythonUnitTest.MeVisLabTestCase.createRunTestMethod().
| TestSupport.PythonUnitTest.addTestsToMeVisLabTestCase | ( | globals | ) |
Definition at line 78 of file PythonUnitTest.py.
| TestSupport.PythonUnitTest.skippedDummyTest | ( | _ | ) |
Definition at line 70 of file PythonUnitTest.py.
| TestSupport.PythonUnitTest.writeTestCenterConfigFile | ( | configFilename, | |
executablePath = "", |
|||
resultDirectory = "", |
|||
reportDirectory = "" |
|||
| ) |
Definition at line 230 of file PythonUnitTest.py.
Referenced by TestSupport.PythonUnitTest.MeVisLabTestCase.setUpClass().
|
protected |
Definition at line 268 of file PythonUnitTest.py.
| TestSupport.PythonUnitTest.IterativeTestRegExp = re.compile(r"^(?:DISABLED_)?ITERATIVETEST(\d*_\w+)$") |
Definition at line 75 of file PythonUnitTest.py.
| TestSupport.PythonUnitTest.mlabroot = os.environ.get("MLAB_ROOT") |
Definition at line 66 of file PythonUnitTest.py.
| TestSupport.PythonUnitTest.NormalTestRegExp = re.compile(r"^(?:DISABLED_)?TEST(\d*_\w+)$") |
Definition at line 74 of file PythonUnitTest.py.