コード例 #1
0
ファイル: test_submit_cli.py プロジェクト: zegami/distributed
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start()

        out, err = yield _submit('127.0.0.1:{0}'.format(remote_client.port),
                                 str(invalid_python_script))
        assert b'Traceback' in err
        yield remote_client._close()
コード例 #2
0
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start()

        out, err = yield _submit('127.0.0.1:{0}'.format(remote_client.port),
                                 str(invalid_python_script))
        assert b'Traceback' in err
        yield remote_client._close()
コード例 #3
0
    def test():
        remote_client = RemoteClient(ip="127.0.0.1", local_dir=str(tmpdir))
        yield remote_client._start()

        out, err = yield _submit("127.0.0.1:{0}".format(remote_client.port),
                                 str(valid_python_script))
        assert b"hello world!" in out
        yield remote_client._close()
コード例 #4
0
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start(0)
        remote_process = rpc(remote_client.address)
        upload = yield remote_process.upload_file(filename='script.py', file_payload='x=1')

        assert upload == {'status': 'OK', 'nbytes': 3}
        assert tmpdir.join('script.py').read() == "x=1"

        yield remote_client._close()
コード例 #5
0
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start(0)
        remote_process = rpc(remote_client.address)
        upload = yield remote_process.upload_file(filename='script.py', file_payload='x=1')

        assert upload == {'status': 'OK', 'nbytes': 3}
        assert tmpdir.join('script.py').read() == "x=1"

        yield remote_client._close()
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start(0)
        rr = rpc(remote_client.address)
        yield rr.upload_file(filename='script.py', file_payload='a+1')

        message = yield rr.execute(filename='script.py')
        assert b'\'a\' is not defined' in message['stderr']
        assert message['returncode'] == 1

        yield remote_client._close()
コード例 #7
0
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start(0)
        rr = rpc(remote_client.address)
        yield rr.upload_file(filename='script.py', file_payload='print("hello world!")')

        message = yield rr.execute(filename='script.py')
        assert message['stdout'] == b'hello world!' + os.linesep.encode()
        assert message['returncode'] == 0

        yield remote_client._close()
コード例 #8
0
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start(0)
        rr = rpc(remote_client.address)
        yield rr.upload_file(filename='script.py', file_payload='a+1')

        message = yield rr.execute(filename='script.py')
        assert b'\'a\' is not defined' in message['stderr']
        assert message['returncode'] == 1

        yield remote_client._close()
コード例 #9
0
    def test():
        remote_client = RemoteClient(ip='127.0.0.1', local_dir=str(tmpdir))
        yield remote_client._start(0)
        rr = rpc(remote_client.address)
        yield rr.upload_file(filename='script.py', file_payload='print("hello world!")')

        message = yield rr.execute(filename='script.py')
        assert message['stdout'] == b'hello world!' + os.linesep.encode()
        assert message['returncode'] == 0

        yield remote_client._close()
コード例 #10
0
    def test():
        remote_client = RemoteClient(ip="127.0.0.1", local_dir=str(tmpdir))
        yield remote_client._start(0)
        rr = rpc(remote_client.address)
        yield rr.upload_file(filename="script.py", file_payload="a+1")

        message = yield rr.execute(filename="script.py")
        assert b"'a' is not defined" in message["stderr"]
        assert message["returncode"] == 1

        yield remote_client._close()
コード例 #11
0
    def test():
        remote_client = RemoteClient(ip="127.0.0.1", local_dir=str(tmpdir))
        yield remote_client._start(0)
        rr = rpc(remote_client.address)
        yield rr.upload_file(filename="script.py", file_payload='print("hello world!")')

        message = yield rr.execute(filename="script.py")
        assert message["stdout"] == b"hello world!" + os.linesep.encode()
        assert message["returncode"] == 0

        yield remote_client._close()
コード例 #12
0
    def test():
        remote_client = RemoteClient(ip="127.0.0.1", local_dir=str(tmpdir))
        yield remote_client._start(0)
        remote_process = rpc(remote_client.address)
        upload = yield remote_process.upload_file(
            filename="script.py", file_payload="x=1"
        )

        assert upload == {"status": "OK", "nbytes": 3}
        assert tmpdir.join("script.py").read() == "x=1"

        yield remote_client._close()