示例#1
0
def test_execute_command_should_fail():
    try:
        actual_res = utils.execute_command(['ls', '--help-does-not-exist'])
    except subprocess.CalledProcessError as e:
        assert True, "Expected exception thrown."
    else:
        assert False, "Unexpected exception (or no exception) thrown"
示例#2
0
def test_execute_command_should_succeed():
    actual_res = utils.execute_command(['ls', '--help'])
    assert actual_res == 0, actual_res
示例#3
0
    def test_execute_command(self):
        actual_res = utils.execute_command(['ls', '--help'])
        self.assertEquals(actual_res, 0, actual_res)

        actual_res = utils.execute_command(['ls', '--help-does-not-exist'])
        self.assertEquals(actual_res, 2, actual_res)