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()
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()
def new_session(self, python="python"): if not py.path.local().sysfind(python): python = str(STATIC_DIR.join(python)) ip = Interpreter(python) self.sessions[ip.pid] = ip self.updating[ip.pid] = False return ip.pid
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")
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")
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