Ejemplo n.º 1
0
def test_command():
    """
    Test command execution

    The true and false commands should reliably succeed and fail in most Linux
    environments.
    """
    cmd = ["true"]
    command = Command(cmd)
    command.execute()
    assert command.success()

    # Specifying the command as a string instead of a list.
    cmd = "true"
    command = Command(cmd)
    command.execute()
    assert command.success()

    cmd = ["false"]
    command = Command(cmd)
    command.execute()
    assert not command.success()