예제 #1
0
파일: test_rpc.py 프로젝트: pyneda/aiorpc
    async def _test_call():
        client = RPCClient(HOST, PORT)

        ret = await client.call('echo', 'message')
        eq_('message', ret)

        ret = await client.call('echo', 'message' * 100)
        eq_('message' * 100, ret)
        client.close()
예제 #2
0
파일: test_rpc.py 프로젝트: pyneda/aiorpc
    async def _test_call_server_side_exception():
        client = RPCClient(HOST, PORT)

        try:
            ret = await client.call('raise_error')
        except RPCError as e:
            eq_('error msg', str(e))
            raise

        eq_('message', ret)
        client.close()
예제 #3
0
    async def _test_call_server_side_exception():
        client = RPCClient(path=PATH)

        try:
            ret = await client.call('raise_error')
        except EnhancedRPCError as e:
            client.close()
            eq_(e.parent, 'Exception')
            eq_('error msg', e.message)
            eq_('Exception: error msg', str(e))
            raise RPCError

        eq_('message', ret)
예제 #4
0
from aiorpc import RPCClient

import asyncio
import uvloop

async def do(cli):
    ret = await client.call('echo', 'message')
    print("{}\n".format(ret))

loop = uvloop.new_event_loop()
asyncio.set_event_loop(loop)
client = RPCClient('127.0.0.1', 6000)
loop.run_until_complete(do(client))
client.close()
예제 #5
0
    async def _test_call():
        client = RPCClient(path=PATH)
        ret = await client.call('echo', 'message')

        eq_('message', ret)
        client.close()
예제 #6
0
    async def _test_class_call():
        client = RPCClient(HOST, PORT)
        ret = await client.call('my_class.echo', 'message')

        eq_('message', ret)
        client.close()
예제 #7
0
    async def _test_call_socket_timeout():
        client = RPCClient(path=PATH, timeout=1)

        await client.call('echo_delayed', 'message', 10)
        client.close()