Пример #1
0
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()
Пример #2
0
    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()
Пример #3
0
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()
Пример #4
0
def test_upload_file_sync(loop):
    with cluster() as (c, [a, b]):
        with Executor(('127.0.0.1', c['port'])) as e:
            def g():
                import myfile
                return myfile.x

            with tmp_text('myfile.py', 'x = 123') as fn:
                e.upload_file(fn)
                x = e.submit(g)
                assert x.result() == 123
Пример #5
0
def test_upload_file_sync(loop):
    with cluster() as (s, [a, b]):
        with Executor(('127.0.0.1', s['port'])) as e:
            def g():
                import myfile
                return myfile.x

            with tmp_text('myfile.py', 'x = 123') as fn:
                e.upload_file(fn)
                x = e.submit(g)
                assert x.result() == 123
Пример #6
0
    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()
Пример #7
0
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()
Пример #8
0
    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()
Пример #9
0
def test_upload_file_exception_sync(loop):
    with cluster() as (c, [a, b]):
        with Executor(('127.0.0.1', c['port'])) as e:
            with tmp_text('myfile.py', 'syntax-error!') as fn:
                with pytest.raises(SyntaxError):
                    e.upload_file(fn)
Пример #10
0
def test_upload_file_exception_sync(loop):
    with cluster() as (s, [a, b]):
        with Executor(('127.0.0.1', s['port'])) as e:
            with tmp_text('myfile.py', 'syntax-error!') as fn:
                with pytest.raises(SyntaxError):
                    e.upload_file(fn)