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
24
25def getTestsToOmit(moduleName):
26 """Return list of tests to omit for this module.
27 If the module does not define this tag or if it is empty, an empty list
28 is returned.
29 """
30 moduleInfo = mevis.MLAB.moduleInfo(moduleName)
31
32 testsToOmit = []
33
34 if TESTS_TO_OMIT_TAG in moduleInfo:
35 testsToOmit = moduleInfo[TESTS_TO_OMIT_TAG].lower().split()
36
37 return testsToOmit
38
39
41 Logging.info('"%s" test was omitted due to the test machine\'s configuration' % testIdentifier)
42
43
44def isTestOmittedAndLogIfSo(moduleName, testIdentifier):
45 isOmitted = isTestOmitted(moduleName, testIdentifier)
46
47 if isOmitted:
48 Logging.info('"%s" test was omitted on module demand' % testIdentifier)
49
50 return isOmitted
51
52
53def isTestOmitted(moduleName, testIdentifier):
54 omittedTests = getTestsToOmit(moduleName)
55
56 directlyOmitted = testIdentifier in omittedTests
57 allOmitted = ALL_TESTS_IDENTIFIER in omittedTests
58
59 return directlyOmitted or allOmitted
isTestOmittedAndLogIfSo(moduleName, testIdentifier)
Definition Generic.py:44
logThatTestWasOmittedByConfiguration(testIdentifier)
Definition Generic.py:40
getTestsToOmit(moduleName)
Definition Generic.py:25
isTestOmitted(moduleName, testIdentifier)
Definition Generic.py:53