Esempio n. 1
0
def test_does_not_die():
    i = Interpreter("python", kill_timeout=1, timeout=3)
    while not i.interact().endswith(">>> "):
        pass
    i.interact("import time\n")
    for _ in range(6):
        i.interact("time.sleep(.2)\n")
Esempio n. 2
0
def test_kill_timeout_outside():
    py.test.skip("XXX")
    i = Interpreter("python", kill_timeout=1, timeout=3)
    while not i.interact().endswith(">>> "):
        pass
    sleep(8)
    i.interact()
Esempio n. 3
0
def test_multiline_command():
    i = Interpreter("python", timeout=3)
    while not i.interact().endswith(">>> "):
        pass
    val = i.interact("def f(x):\n y = x + 3\n return y\n\nf(8)\n")
    while val is not None:
        assert 'Traceback' not in val
        assert 'Syntax' not in val
        print val
        val = i.interact()
Esempio n. 4
0
def test_two_interpreters():
    i = Interpreter("python", timeout=3)
    i2 = Interpreter("python", timeout=3)
    while not i.interact().endswith(">>> "):
        pass
    while not i2.interact().endswith(">>> "):
        pass

    def f():
        return i.interact("import time;time.sleep(1)\n")
    def g():
        return i2.interact("a\n")

    one, two = allof(g, f)
    assert two.startswith(">>")
    assert one.startswith("Traceback")
Esempio n. 5
0
def test_greensock_reader_timeouter():
    i = Interpreter("python", timeout=3)
    while not i.interact().endswith(">>> "):
        pass
    assert i.interact() is None
    assert i.interact("a\n") is not None