Ejemplo n.º 1
0
def test_can_run_vim():
    f = tempfile.mktemp()
    with Runner("/usr/bin/vim") as h:
        h.await_text("VIM")
        h.press("i")
        h.write("Hello world")
        h.press("Enter")
        h.write("Goodbye world")
        h.press("Escape")
        h.write("dd")
        h.write(":w " + f)
        h.press("Enter")
        h.write(":q")
        h.press("Enter")
        # Second enter because if running with unset environment in tox it will
        # complain that it can't write viminfo and tell you to press enter to
        # continue.
        h.press("Enter")
        h.await_exit()
    with open(f) as r:
        text = r.read()
        assert "Hello world" in text
        assert "Goodbye world" not in text
Ejemplo n.º 2
0
def test_can_run_vim():
    f = tempfile.mktemp()
    with Runner("/usr/bin/vim") as h:
        h.await_text("VIM")
        h.press("i")
        h.write("Hello world")
        h.press("Enter")
        h.write("Goodbye world")
        h.press("Escape")
        h.write("dd")
        h.write(":w " + f)
        h.press("Enter")
        h.write(":q")
        h.press("Enter")
        # Second enter because if running with unset environment in tox it will
        # complain that it can't write viminfo and tell you to press enter to
        # continue.
        h.press("Enter")
        h.await_exit()
    with open(f) as r:
        text = r.read()
        assert "Hello world" in text
        assert "Goodbye world" not in text
Ejemplo n.º 3
0
def test_can_launch_a_simple_program():
    f = tempfile.mktemp()
    with Runner("bash", "-c", "echo hello world > %s" % (f, )):
        return
    with open(f) as r:
        assert "Hello world" in r.read()
Ejemplo n.º 4
0
def test_can_launch_a_simple_program():
    f = tempfile.mktemp()
    with Runner("bash", "-c", "echo hello world > %s" % (f,)):
        return
    with open(f) as r:
        assert "Hello world" in r.read()