TestCenter Reference
Generic.py
Go to the documentation of this file.
1 # **InsertLicense** code author="Ruben Stein"
2 
3 
4 """Shared code for generic tests"""
5 
6 from TestSupport import Logging
7 
8 # -- local imports ---------------------------------------------------------{{{-
9 import mevis
10 
11 TESTS_TO_OMIT_TAG = 'testsToOmit'
12 FORMAL_TEST_IDENTIFIER = 'formal'
13 ALL_TESTS_IDENTIFIER = 'all'
14 EXAMPLE_NETWORK_TEST_IDENTIFIER = 'example_network'
15 PANEL_TEST_IDENTIFIER = 'open_panel'
16 
17 def getTestsToOmit (moduleName):
18  """Return list of tests to omit for this module.
19  If the module does not define this tag or if it is empty, an empty list
20  is returned.
21  """
22  moduleInfo = mevis.MLAB.moduleInfo(moduleName)
23 
24  testsToOmit = []
25 
26  if TESTS_TO_OMIT_TAG in moduleInfo:
27  testsToOmit = moduleInfo[ TESTS_TO_OMIT_TAG ].lower().split()
28 
29  return testsToOmit
30 
32  Logging.info('"%s" test was omitted due to the test machine\'s configuration' % testIdentifier)
33 
34 def isTestOmittedAndLogIfSo(moduleName, testIdentifier):
35  isOmitted = isTestOmitted(moduleName, testIdentifier)
36 
37  if isOmitted:
38  Logging.info('"%s" test was omitted on module demand' % testIdentifier)
39 
40  return isOmitted
41 
42 def isTestOmitted(moduleName, testIdentifier):
43  omittedTests = getTestsToOmit(moduleName)
44 
45  directlyOmitted = testIdentifier in omittedTests
46  allOmitted = ALL_TESTS_IDENTIFIER in omittedTests
47 
48  return directlyOmitted or allOmitted
def logThatTestWasOmittedByConfiguration(testIdentifier)
Definition: Generic.py:31
def isTestOmitted(moduleName, testIdentifier)
Definition: Generic.py:42
def isTestOmittedAndLogIfSo(moduleName, testIdentifier)
Definition: Generic.py:34
def getTestsToOmit(moduleName)
Definition: Generic.py:17