示例#1
0
 def test_shouldStop(self):
     """
     When result.shouldStop == True, the suite should exit early.
     """
     mock_test = MagicMock()
     gts = GreenTestSuite(args=default_args)
     gts._tests = (mock_test,)
     mock_result = MagicMock()
     mock_result.shouldStop = True
     gts.run(mock_result)
示例#2
0
 def test_shouldStop(self):
     """
     When result.shouldStop == True, the suite should exit early.
     """
     mock_test = MagicMock()
     gts = GreenTestSuite(args=default_args)
     gts._tests = (mock_test, )
     mock_result = MagicMock()
     mock_result.shouldStop = True
     gts.run(mock_result)
示例#3
0
 def test_failedModuleSetup(self):
     """
     When module setup fails, we skip to the next test.
     """
     mock_test = MagicMock()
     mock_test.__iter__.side_effect = TypeError
     gts = GreenTestSuite(args=default_args)
     gts._tests = (mock_test,)
     mock_result = MagicMock()
     mock_result._moduleSetUpFailed = True
     mock_result.shouldStop = False
     gts.run(mock_result)
示例#4
0
 def test_failedModuleSetup(self):
     """
     When module setup fails, we skip to the next test.
     """
     mock_test = MagicMock()
     mock_test.__iter__.side_effect = TypeError
     gts = GreenTestSuite(args=default_args)
     gts._tests = (mock_test, )
     mock_result = MagicMock()
     mock_result._moduleSetUpFailed = True
     mock_result.shouldStop = False
     gts.run(mock_result)
示例#5
0
 def test_failedModuleTeardown(self):
     """
     When module teardown fails, we report an error.
     """
     mock_module = MagicMock()
     mock_test = MagicMock()
     mock_err = MagicMock()
     args = copy.deepcopy(default_args)
     gts = GreenTestSuite(args=args)
     gts._get_previous_module = mock_module
     mock_result = MagicMock()
     mock_result.errors.__len__.side_effect = [0, 1, 1]
     mock_result.errors.__getitem__.side_effect = [[],
                                                   [(mock_test, mock_err)]]
     mock_result._previousTestClass.__name__ = "mockClass"
     gts.run(mock_result)
     self.assertTrue(mock_test.is_class_or_module_teardown_error)