Code Duplication    Length = 16-19 lines in 3 locations

smartdispatch/tests/test_command_manager.py 3 locations

@@ 100-118 (lines=19) @@
97
98
        assert_true(not os.path.isfile(self.command_manager._failed_commands_filename))
99
100
    def test_set_running_command_as_pending(self):
101
        # SetUp
102
        command = self.command_manager.get_command_to_run()
103
104
        # The function to test
105
        self.command_manager.set_running_command_as_pending(command)
106
107
        # Test validation
108
        with open(self.command_manager._commands_filename, "r") as commands_file:
109
            assert_equal(commands_file.read(), self.command2 + self.command3 + self.command1)
110
111
        with open(self.command_manager._running_commands_filename, "r") as running_commands_file:
112
            assert_equal(running_commands_file.read(), "")
113
114
        assert_true(not os.path.isfile(self.command_manager._finished_commands_filename))
115
        assert_true(not os.path.isfile(self.command_manager._failed_commands_filename))
116
117
    def test_set_running_command_as_failed(self):
118
        # SetUp
119
        command = self.command_manager.get_command_to_run()
120
        error_code = 1
121
@@ 81-98 (lines=18) @@
78
    def test_get_nb_commands_to_run(self):
79
        assert_equal(self.command_manager.get_nb_commands_to_run(), self.nb_commands)
80
81
    def test_set_running_command_as_finished(self):
82
        # SetUp
83
        command = self.command_manager.get_command_to_run()
84
85
        # The function to test
86
        self.command_manager.set_running_command_as_finished(command)
87
88
        # Test validation
89
        with open(self.command_manager._commands_filename, "r") as commands_file:
90
            assert_equal(commands_file.read(), self.command2 + self.command3)
91
92
        with open(self.command_manager._running_commands_filename, "r") as running_commands_file:
93
            assert_equal(running_commands_file.read(), "")
94
95
        with open(self.command_manager._finished_commands_filename, "r") as finished_commands_file:
96
            assert_equal(finished_commands_file.read(), self.command1)
97
98
        assert_true(not os.path.isfile(self.command_manager._failed_commands_filename))
99
100
    def test_set_running_command_as_pending(self):
101
        # SetUp
@@ 100-115 (lines=16) @@
97
98
        assert_true(not os.path.isfile(self.command_manager._failed_commands_filename))
99
100
    def test_set_running_command_as_pending(self):
101
        # SetUp
102
        command = self.command_manager.get_command_to_run()
103
104
        # The function to test
105
        self.command_manager.set_running_command_as_pending(command)
106
107
        # Test validation
108
        with open(self.command_manager._commands_filename, "r") as commands_file:
109
            assert_equal(commands_file.read(), self.command2 + self.command3 + self.command1)
110
111
        with open(self.command_manager._running_commands_filename, "r") as running_commands_file:
112
            assert_equal(running_commands_file.read(), "")
113
114
        assert_true(not os.path.isfile(self.command_manager._finished_commands_filename))
115
        assert_true(not os.path.isfile(self.command_manager._failed_commands_filename))
116
117
    def test_set_running_command_as_failed(self):
118
        # SetUp