|
@@ 40-51 (lines=12) @@
|
| 37 |
|
self.assertFalse(report.is_success) |
| 38 |
|
self.assertEqual(report.get_action_status(a).status, FAILED) |
| 39 |
|
|
| 40 |
|
def test_keyboard_interrupt(self): |
| 41 |
|
a = self._action("a", exception=KeyboardInterrupt()) |
| 42 |
|
|
| 43 |
|
with self.assertRaises(CompoundException) as catcher: |
| 44 |
|
execute(a) |
| 45 |
|
report = catcher.exception.execution_report |
| 46 |
|
|
| 47 |
|
self.assertEqual(len(catcher.exception.exceptions), 1) |
| 48 |
|
self.assertEqual(catcher.exception.exceptions[0].__class__, KeyboardInterrupt) |
| 49 |
|
|
| 50 |
|
self.assertFalse(report.is_success) |
| 51 |
|
self.assertEqual(report.get_action_status(a).status, FAILED) |
| 52 |
|
|
| 53 |
|
def test_simple_failure_without_raise(self): |
| 54 |
|
a = self._action("a", exception=Exception("foobar")) |
|
@@ 27-38 (lines=12) @@
|
| 24 |
|
self.assertFalse(report.is_success) |
| 25 |
|
self.assertEqual(report.get_action_status(a).status, FAILED) |
| 26 |
|
|
| 27 |
|
def test_exit(self): |
| 28 |
|
a = self._action("a", exception=SystemExit()) |
| 29 |
|
|
| 30 |
|
with self.assertRaises(CompoundException) as catcher: |
| 31 |
|
execute(a) |
| 32 |
|
report = catcher.exception.execution_report |
| 33 |
|
|
| 34 |
|
self.assertEqual(len(catcher.exception.exceptions), 1) |
| 35 |
|
self.assertEqual(catcher.exception.exceptions[0].__class__, SystemExit) |
| 36 |
|
|
| 37 |
|
self.assertFalse(report.is_success) |
| 38 |
|
self.assertEqual(report.get_action_status(a).status, FAILED) |
| 39 |
|
|
| 40 |
|
def test_keyboard_interrupt(self): |
| 41 |
|
a = self._action("a", exception=KeyboardInterrupt()) |
|
@@ 14-25 (lines=12) @@
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
class ExceptionsHandlingTestCase(ActionTreeTestCase): |
| 14 |
|
def test_simple_failure(self): |
| 15 |
|
a = self._action("a", exception=Exception("foobar")) |
| 16 |
|
|
| 17 |
|
with self.assertRaises(CompoundException) as catcher: |
| 18 |
|
execute(a) |
| 19 |
|
report = catcher.exception.execution_report |
| 20 |
|
|
| 21 |
|
self.assertEqual(len(catcher.exception.exceptions), 1) |
| 22 |
|
self.assertEqual(catcher.exception.exceptions[0].args, ("foobar",)) |
| 23 |
|
|
| 24 |
|
self.assertFalse(report.is_success) |
| 25 |
|
self.assertEqual(report.get_action_status(a).status, FAILED) |
| 26 |
|
|
| 27 |
|
def test_exit(self): |
| 28 |
|
a = self._action("a", exception=SystemExit()) |