Code Duplication    Length = 12-12 lines in 2 locations

ActionTree/tests/exceptions_handling.py 2 locations

@@ 52-63 (lines=12) @@
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
52
    def test_exceptions_in_dependency_with_weak_dependencies(self):
53
        a = self._action("a", weak_dependencies=True)
54
        b = self._action("b", exception=Exception("foobar"))
55
        a.add_dependency(b)
56
57
        with self.assertRaises(CompoundException) as catcher:
58
            execute(a, jobs=1)
59
        report = catcher.exception.execution_report
60
61
        self.assertFalse(report.is_success)
62
        self.assertEqual(report.get_action_status(a).status, ExecutionReport.ActionStatus.SUCCESSFUL)
63
        self.assertEqual(report.get_action_status(b).status, ExecutionReport.ActionStatus.FAILED)
64
65
    def test_exceptions_in_dependencies_with_keep_going(self):
66
        a = self._action("a")
@@ 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, jobs=1)
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, ExecutionReport.ActionStatus.FAILED)
26
27
    def test_simple_failure_without_raise(self):
28
        a = self._action("a", exception=Exception("foobar"))