TestCenter Reference
Formal.py
Go to the documentation of this file.
2# Copyright 2016, MeVis Medical Solutions AG
3#
4# The user may use this file in accordance with the license agreement provided with
5# the Software or, alternatively, in accordance with the terms contained in a
6# written agreement between the user and MeVis Medical Solutions AG.
7#
8# For further information use the contact form at https://www.mevislab.de/contact
9#
10
11import os
12import re
13from TestSupport import Base
14from mevis import MLABTestCaseDatabase
15
17 # ignore the deprecation warnings only if this module is deprecated
18 if isModuleToBeRemoved(modInfo):
19 regExp = re.compile(r"^Network\‍(\d+\‍)\sThis\smodule\stype\sis\sdeprecated\sand\swill\sbe\sremoved.*$")
20 Base.expectWarning(func, warningRegExp=regExp)
21 else:
22 func()
23
24def isModuleToBeRemoved(moduleInfo):
25 for key in moduleInfo:
26 if key.lower() == "group":
27 return "toberemoved" in moduleInfo[key].lower()
28 return False
29
31 disableScreenshots = 'MLAB_TC_NO_SCREENSHOTS' in os.environ
32 return disableScreenshots
33
34def getList(modInfo, itemListName): # --------------------------------------{{{-
35 return modInfo[itemListName] if type(modInfo[itemListName]) in (tuple, list) else (modInfo[itemListName],)
36
37def getListFromString(modInfo, itemListName):
38 string = modInfo[itemListName]
39 if "," in string:
40 listParts = [x.strip() for x in string.split(",")]
41 else:
42 listParts = string.split()
43 return listParts
44
45def isTestInSamePackage(testName, packageName): # --------------------------{{{-
46 testInfo = MLABTestCaseDatabase.testCaseInfo(testName)
47 return len(testInfo) > 0 and testInfo['package'] == packageName
48# --------------------------------------------------------------------------}}}-
49
50def initTestDataBase(): # --------------------------------------------------{{{-
51 """ Initializes the test case data base if it is not
52 already initialized."""
53 if not MLABTestCaseDatabase.areTestCasesLoaded():
54 MLABTestCaseDatabase.loadTestCases()
55# --------------------------------------------------------------------------}}}-
runFunctionButIgnoredDeprecationWarnings(func, modInfo)
Definition Formal.py:16
areScreenshotsDisabledByEnvironmentVariable()
Definition Formal.py:30
getListFromString(modInfo, itemListName)
Definition Formal.py:37
isModuleToBeRemoved(moduleInfo)
Definition Formal.py:24
getList(modInfo, itemListName)
Definition Formal.py:34
isTestInSamePackage(testName, packageName)
Definition Formal.py:45