def f(c, a, b): e = Executor((c.ip, c.port), start=False, loop=loop) yield e._start() with tmp_text('myfile.py', 'syntax-error!') as fn: with pytest.raises(SyntaxError): yield e._upload_file(fn) yield e._shutdown()
def test_upload_file_exception(s, a, b): e = Executor((s.ip, s.port), start=False) yield e._start() with tmp_text('myfile.py', 'syntax-error!') as fn: with pytest.raises(SyntaxError): yield e._upload_file(fn) yield e._shutdown()
def f(c, a, b): e = Executor((c.ip, c.port), start=False, loop=loop) yield e._start() def g(): import myfile return myfile.f() with tmp_text('myfile.py', 'def f():\n return 123') as fn: yield e._upload_file(fn) sleep(1) # TODO: why is this necessary? x = e.submit(g, pure=False) result = yield x._result() assert result == 123 with tmp_text('myfile.py', 'def f():\n return 456') as fn: yield e._upload_file(fn) y = e.submit(g, pure=False) result = yield y._result() assert result == 456 yield e._shutdown()
def test_upload_file(s, a, b): e = Executor((s.ip, s.port), start=False) yield e._start() def g(): import myfile return myfile.f() with tmp_text('myfile.py', 'def f():\n return 123') as fn: yield e._upload_file(fn) sleep(1) # TODO: why is this necessary? x = e.submit(g, pure=False) result = yield x._result() assert result == 123 with tmp_text('myfile.py', 'def f():\n return 456') as fn: yield e._upload_file(fn) y = e.submit(g, pure=False) result = yield y._result() assert result == 456 yield e._shutdown()
def f(c, a, b): e = Executor((c.ip, c.port), start=False, loop=loop) yield e._start() def g(): import myfile return myfile.x with tmp_text('myfile.py', 'x = 123') as fn: yield e._upload_file(fn) x = e.submit(g) result = yield x._result() assert result == 123 yield e._shutdown()