TestCenter Reference
Generic.py
Go to the documentation of this file.
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
13from TestSupport import Logging
14
15# -- local imports ---------------------------------------------------------{{{-
16import mevis
17
18TESTS_TO_OMIT_TAG = 'testsToOmit'
19FORMAL_TEST_IDENTIFIER = 'formal'
20ALL_TESTS_IDENTIFIER = 'all'
21EXAMPLE_NETWORK_TEST_IDENTIFIER = 'example_network'
22PANEL_TEST_IDENTIFIER = 'open_panel'
23
24def 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
41def 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
49def 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
isTestOmittedAndLogIfSo(moduleName, testIdentifier)
Definition Generic.py:41
logThatTestWasOmittedByConfiguration(testIdentifier)
Definition Generic.py:38
getTestsToOmit(moduleName)
Definition Generic.py:24
isTestOmitted(moduleName, testIdentifier)
Definition Generic.py:49