Пример #1
0
def tcp_server(loop):
    (server,) = loop.run_until_complete(start_manhole(port=0, loop=loop))
    (socket,) = server.sockets
    (ip, port) = socket.getsockname()

    yield loop.run_until_complete(asyncio.open_connection('127.0.0.1', port, loop=loop))

    server.close()
    loop.run_until_complete(server.wait_closed())
Пример #2
0
def tcp_server(loop):
    (server, ) = loop.run_until_complete(start_manhole(port=0, loop=loop))
    (socket, ) = server.sockets
    (ip, port) = socket.getsockname()

    yield loop.run_until_complete(
        asyncio.open_connection('127.0.0.1', port, loop=loop))

    server.close()
    loop.run_until_complete(server.wait_closed())
Пример #3
0
def unix_server(loop):
    directory = tempfile.mkdtemp()

    try:
        domain_socket = os.path.join(directory, 'aiomanhole')
        (server,) = loop.run_until_complete(start_manhole(path=domain_socket, loop=loop))

        yield loop.run_until_complete(asyncio.open_unix_connection(path=domain_socket, loop=loop))

        server.close()
        loop.run_until_complete(server.wait_closed())

    finally:
        shutil.rmtree(directory)
Пример #4
0
def unix_server(loop):
    directory = tempfile.mkdtemp()

    try:
        domain_socket = os.path.join(directory, 'aiomanhole')
        (server, ) = loop.run_until_complete(
            start_manhole(path=domain_socket, loop=loop))

        yield loop.run_until_complete(
            asyncio.open_unix_connection(path=domain_socket, loop=loop))

        server.close()
        loop.run_until_complete(server.wait_closed())

    finally:
        shutil.rmtree(directory)
Пример #5
0
 def set_manhole():
     aiomanhole.start_manhole(port=7113, namespace={"qtile": qtile})