11 from unittest.mock
import patch
17 import FormalMacroModule
23 with patch(
"mevis.MLAB.moduleInfo")
as moduleInfoMock:
24 moduleName =
"dummyModuleName"
25 moduleInfoMock.return_value = {TESTS_TO_OMIT_TAG:
" ".join([FORMAL_TEST_IDENTIFIER, META_TEST_IDENTIFIER])}
28 self.assertListEqual([FORMAL_TEST_IDENTIFIER, META_TEST_IDENTIFIER], omittedTests)
29 moduleInfoMock.assert_called_once_with(moduleName)
32 with patch(
"mevis.MLAB.moduleInfo")
as moduleInfoMock:
33 moduleName =
"dummyModuleName"
34 moduleInfoMock.return_value = {}
37 self.assertListEqual([], omittedTests)
38 moduleInfoMock.assert_called_once_with(moduleName)
41 with patch(
"mevis.MLAB.moduleInfo")
as moduleInfoMock:
42 moduleName =
"dummyModuleName"
43 moduleInfoMock.return_value = {TESTS_TO_OMIT_TAG: ALL_TESTS_IDENTIFIER}
46 self.assertIn(ALL_TESTS_IDENTIFIER, omittedTests)
47 moduleInfoMock.assert_called_once_with(moduleName)
50 with patch(
"TestSupport.Generic.getTestsToOmit")
as omitMock:
51 moduleName =
"DummyModuleName"
53 omitMock.return_value = [FORMAL_TEST_IDENTIFIER, META_TEST_IDENTIFIER]
55 self.assertTrue(omitted)
57 self.assertFalse(Formal.testModule(moduleName))
58 self.assertFalse(FormalMacroModule.testModule(moduleName))
59 self.assertFalse(Meta.testModule(moduleName))
62 omitMock.return_value = [ALL_TESTS_IDENTIFIER]
64 self.assertTrue(omitted)
66 self.assertFalse(Formal.testModule(moduleName))
67 self.assertFalse(FormalMacroModule.testModule(moduleName))
68 self.assertFalse(Meta.testModule(moduleName))
71 omitMock.return_value = []
73 self.assertFalse(omitted)
75 self.assertTrue(Formal.testModule(moduleName))
76 self.assertTrue(FormalMacroModule.testModule(moduleName))
77 self.assertTrue(Meta.testModule(moduleName))
79 if __name__ ==
"__main__":
def testOmitNothing(self)
def getTestsToOmit(moduleName)
def isTestOmitted(moduleName, testIdentifier)