示例#1
0
async def test_no_free_channels(amqp_connection: aiormq.Connection):
    await asyncio.wait_for(
        asyncio.wait([
            amqp_connection.channel(n + 1)
            for n in range(amqp_connection.connection_tune.channel_max)
        ], ),
        timeout=60,
    )

    with pytest.raises(aiormq.exceptions.ConnectionNotAllowed):
        await asyncio.wait_for(amqp_connection.channel(), timeout=5)
示例#2
0
async def amqp_connection(amqp_url, loop):
    connection = Connection(amqp_url, loop=loop)

    await connection.connect()

    try:
        await yield_(connection)
    finally:
        await connection.close()
示例#3
0
async def amqp_connection(request, event_loop):
    connection = Connection(request.param, loop=event_loop)

    await connection.connect()

    try:
        await yield_(connection)
    finally:
        await connection.close()
示例#4
0
async def proxy_connection(proxy: TCPProxy, amqp_url: URL, loop):
    url = amqp_url.with_host("localhost", ).with_port(proxy.proxy_port, )
    connection = Connection(url, loop=loop)

    await connection.connect()

    try:
        yield connection
    finally:
        await connection.close()
示例#5
0
async def amqp_connection(amqp_url, loop):
    connection = Connection(amqp_url, loop=loop)
    async with connection:
        yield connection