Example #1
0
 def test_two_recaptured_neq(self):
     captured = _captured_failure('Woot!')
     fail_obj = failure.Failure(
         exception_str=captured.exception_str,
         traceback_str=captured.traceback_str,
         exc_type_names=captured.exception_type_names)
     new_exc_str = captured.exception_str.replace('Woot', 'w00t')
     fail_obj2 = failure.Failure(
         exception_str=new_exc_str,
         traceback_str=captured.traceback_str,
         exc_type_names=captured.exception_type_names)
     self.assertNotEqual(fail_obj, fail_obj2)
     self.assertFalse(fail_obj2.matches(fail_obj))
Example #2
0
 def setUp(self):
     super(ReCreatedFailureTestCase, self).setUp()
     fail_obj = _captured_failure('Woot!')
     self.fail_obj = failure.Failure(
         exception_str=fail_obj.exception_str,
         traceback_str=fail_obj.traceback_str,
         exc_type_names=fail_obj.exception_type_names)
Example #3
0
 def test_no_capture_exc_args(self):
     captured = _captured_failure(Exception("I am not valid JSON"))
     fail_obj = failure.Failure(
         exception_str=captured.exception_str,
         traceback_str=captured.traceback_str,
         exc_type_names=captured.exception_type_names,
         exc_args=captured.exception_args)
     fail_json = fail_obj.to_dict(include_args=False)
     self.assertNotEqual(fail_obj.exception_args, fail_json['exc_args'])
     self.assertEqual(fail_json['exc_args'], tuple())
Example #4
0
 def test_recaptured_not_eq(self):
     captured = _captured_failure('Woot!')
     fail_obj = failure.Failure(
         exception_str=captured.exception_str,
         traceback_str=captured.traceback_str,
         exc_type_names=captured.exception_type_names,
         exc_args=captured.exception_args,
         generated_on=captured.generated_on)
     self.assertFalse(fail_obj == captured)
     self.assertTrue(fail_obj != captured)
     self.assertTrue(fail_obj.matches(captured))
Example #5
0
 def test_failure_copy_recaptured(self):
     captured = _captured_failure('Woot!')
     fail_obj = failure.Failure(
         exception_str=captured.exception_str,
         traceback_str=captured.traceback_str,
         exc_type_names=captured.exception_type_names)
     copied = fail_obj.copy()
     self.assertIsNot(fail_obj, copied)
     self.assertEqual(fail_obj, copied)
     self.assertFalse(fail_obj != copied)
     self.assertTrue(fail_obj.matches(copied))