| @@ 23-38 (lines=16) @@ | ||
| 20 | ||
| 21 | self.assertEventsEqual("a " * self.REPEAT) |
|
| 22 | ||
| 23 | def test_failure_in_middle(self): |
|
| 24 | a = self._action("a") |
|
| 25 | b = self._action("b", exception=Exception()) |
|
| 26 | c = self._action("c") |
|
| 27 | a.add_dependency(b) |
|
| 28 | b.add_dependency(c) |
|
| 29 | ||
| 30 | for i in range(self.REPEAT): |
|
| 31 | with self.assertRaises(CompoundException) as catcher: |
|
| 32 | execute(a) |
|
| 33 | report = catcher.exception.execution_report |
|
| 34 | self.assertEqual(report.get_action_status(a).status, ExecutionReport.ActionStatus.CANCELED) |
|
| 35 | self.assertEqual(report.get_action_status(b).status, ExecutionReport.ActionStatus.FAILED) |
|
| 36 | self.assertEqual(report.get_action_status(c).status, ExecutionReport.ActionStatus.SUCCESSFUL) |
|
| 37 | ||
| 38 | self.assertEventsEqual("c b " * self.REPEAT) |
|
| 39 | ||
| @@ 34-48 (lines=15) @@ | ||
| 31 | ||
| 32 | self.assertFalse(report.is_success) |
|
| 33 | self.assertEqual(report.get_action_status(a).status, ExecutionReport.ActionStatus.FAILED) |
|
| 34 | self.assertEqual(report.get_action_status(a).exception.args, ("foobar",)) |
|
| 35 | ||
| 36 | def test_exception_in_dependency(self): |
|
| 37 | a = self._action("a") |
|
| 38 | b = self._action("b", exception=Exception("foobar")) |
|
| 39 | a.add_dependency(b) |
|
| 40 | ||
| 41 | with self.assertRaises(CompoundException) as catcher: |
|
| 42 | execute(a, jobs=1) |
|
| 43 | report = catcher.exception.execution_report |
|
| 44 | ||
| 45 | self.assertEqual(len(catcher.exception.exceptions), 1) |
|
| 46 | self.assertEqual(catcher.exception.exceptions[0].args, ("foobar",)) |
|
| 47 | ||
| 48 | self.assertFalse(report.is_success) |
|
| 49 | self.assertEqual(report.get_action_status(a).status, ExecutionReport.ActionStatus.CANCELED) |
|
| 50 | self.assertEqual(report.get_action_status(b).status, ExecutionReport.ActionStatus.FAILED) |
|
| 51 | ||