Пример #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
Пример #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
Пример #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()
Пример #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()