@@ 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 | self.assertEqual(report.get_action_status(a).status, ExecutionReport.ActionStatus.Failed) |
|
32 | self.assertEqual(report.get_action_status(a).exception.args, ("foobar",)) |
|
33 | ||
34 | def test_exception_in_dependency(self): |
|
35 | a = self._action("a") |
|
36 | b = self._action("b", exception=Exception("foobar")) |
|
37 | a.add_dependency(b) |
|
38 | ||
39 | with self.assertRaises(CompoundException) as catcher: |
|
40 | execute(a, jobs=1) |
|
41 | report = catcher.exception.execution_report |
|
42 | ||
43 | self.assertEqual(len(catcher.exception.exceptions), 1) |
|
44 | self.assertEqual(catcher.exception.exceptions[0].args, ("foobar",)) |
|
45 | ||
46 | self.assertFalse(report.is_success) |
|
47 | self.assertEqual(report.get_action_status(a).status, ExecutionReport.ActionStatus.Canceled) |
|
48 | self.assertEqual(report.get_action_status(b).status, ExecutionReport.ActionStatus.Failed) |
|
49 | ||
50 | def test_exceptions_in_dependencies_with_keep_going(self): |
|
51 | a = self._action("a") |