예제 #1
0
 def test_debug_skipped_test_no_cleanup(self, _pre_setup, _post_teardown):
     test_suite = unittest.TestSuite()
     test_suite.addTest(ErrorTestCase('skipped_test'))
     with self.assertRaisesMessage(unittest.SkipTest, 'Skip condition.'):
         # This is the same as test_suite.debug().
         result = _DebugResult()
         test_suite.run(result, debug=True)
     self.assertFalse(_post_teardown.called)
     self.assertFalse(_pre_setup.called)
     self.isolate_debug_test(test_suite, result)
예제 #2
0
 def test_debug_bubbles_error(self, _pre_setup, _post_teardown):
     """debug() bubbles up exceptions before cleanup."""
     test_suite = unittest.TestSuite()
     test_suite.addTest(ErrorTestCase('raising_test'))
     msg = 'debug() bubbles up exceptions before cleanup.'
     with self.assertRaisesMessage(Exception, msg):
         # This is the same as test_suite.debug().
         result = _DebugResult()
         test_suite.run(result, debug=True)
     # pre-setup is called but not post-teardown.
     _pre_setup.assert_called_once_with()
     self.assertFalse(_post_teardown.called)
     self.isolate_debug_test(test_suite, result)
예제 #3
0
 def test_debug_bubbles_pre_setup_error(self, _pre_setup, _post_teardown):
     """debug() bubbles up exceptions during _pre_setup."""
     msg = 'Exception in _pre_setup.'
     _pre_setup.side_effect = Exception(msg)
     test_suite = unittest.TestSuite()
     test_suite.addTest(ErrorTestCase('simple_test'))
     with self.assertRaisesMessage(Exception, msg):
         # This is the same as test_suite.debug().
         result = _DebugResult()
         test_suite.run(result, debug=True)
     # pre-setup is called but not post-teardown.
     _pre_setup.assert_called_once_with()
     self.assertFalse(_post_teardown.called)
     self.isolate_debug_test(test_suite, result)
예제 #4
0
 def debug(self):
     debug = _DebugResult()
     self.run(debug, True)
예제 #5
0
 def debug(self):
     """Run the tests without collecting errors in a TestResult"""
     debug = _DebugResult()
     self.run(debug, True)