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())
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())
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)
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)
def set_manhole(): aiomanhole.start_manhole(port=7113, namespace={"qtile": qtile})