Code Duplication    Length = 15-16 lines in 2 locations

ActionTree/tests/multiple_executions.py 1 location

@@ 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, 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

ActionTree/tests/exceptions_handling.py 1 location

@@ 62-76 (lines=15) @@
59
        self.assertEqual(report.get_action_status(a).status, FAILED)
60
        self.assertEqual(report.get_action_status(a).exception.args, ("foobar",))
61
62
    def test_exception_in_dependency(self):
63
        a = self._action("a")
64
        b = self._action("b", exception=Exception("foobar"))
65
        a.add_dependency(b)
66
67
        with self.assertRaises(CompoundException) as catcher:
68
            execute(a)
69
        report = catcher.exception.execution_report
70
71
        self.assertEqual(len(catcher.exception.exceptions), 1)
72
        self.assertEqual(catcher.exception.exceptions[0].args, ("foobar",))
73
74
        self.assertFalse(report.is_success)
75
        self.assertEqual(report.get_action_status(a).status, CANCELED)
76
        self.assertEqual(report.get_action_status(b).status, FAILED)
77
78
    def test_exceptions_in_dependency_with_accept_failed_dependencies(self):
79
        a = self._action("a", accept_failed_dependencies=True)