1 | # coding: utf8 |
||
2 | |||
3 | # Copyright 2013-2018 Vincent Jacques <[email protected]> |
||
4 | |||
5 | from __future__ import division, absolute_import, print_function |
||
6 | |||
7 | from ActionTree import * |
||
8 | from . import * |
||
9 | |||
10 | |||
11 | class MultipleExecutionsTestCase(ActionTreeTestCase): |
||
12 | REPEAT = 5 |
||
13 | |||
14 | def test_simple_success(self): |
||
15 | a = self._action("a") |
||
16 | |||
17 | for i in range(self.REPEAT): |
||
18 | report = execute(a) |
||
19 | self.assertEqual(report.get_action_status(a).status, SUCCESSFUL) |
||
20 | |||
21 | self.assertEventsEqual("a " * self.REPEAT) |
||
22 | |||
23 | View Code Duplication | def test_failure_in_middle(self): |
|
0 ignored issues
–
show
Duplication
introduced
by
Loading history...
|
|||
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, CANCELED) |
||
35 | self.assertEqual(report.get_action_status(b).status, FAILED) |
||
36 | self.assertEqual(report.get_action_status(c).status, SUCCESSFUL) |
||
37 | |||
38 | self.assertEventsEqual("c b " * self.REPEAT) |
||
39 |