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