async def test_transaction_simple_async_rollback( self, connection: aio_pika.Connection ): async with connection.channel(publisher_confirms=False) as channel: with pytest.raises(ValueError): async with channel.transaction(): raise ValueError
async def test_transaction_simple_rollback( self, connection: aio_pika.Connection ): async with connection.channel(publisher_confirms=False) as channel: tx = channel.transaction() await tx.select() await tx.rollback()
def create_channel( connection: aio_pika.Connection, ) -> Awaitable[aio_pika.Channel]: return connection.channel()
def create_channel(connection: aio_pika.Connection): return connection.channel(publisher_confirms=True)
async def test_transaction_simple_async_commit( self, connection: aio_pika.Connection ): async with connection.channel(publisher_confirms=False) as channel: async with channel.transaction(): pass
async def test_transaction_when_publisher_confirms_error( self, connection: aio_pika.Connection ): async with connection.channel(publisher_confirms=True) as channel: with pytest.raises(RuntimeError): channel.transaction()
async def f(rabbitmq_connection: aio_pika.Connection, weakset): async with rabbitmq_connection.channel() as channel: weakset.add(channel)
async def channel(connection: aio_pika.Connection) -> aio_pika.Channel: async with connection.channel() as ch: await yield_(ch)