Example #1
0
 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
Example #2
0
 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()
Example #3
0
 def create_channel(
     connection: aio_pika.Connection,
 ) -> Awaitable[aio_pika.Channel]:
     return connection.channel()
Example #4
0
 def create_channel(connection: aio_pika.Connection):
     return connection.channel(publisher_confirms=True)
Example #5
0
 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
Example #6
0
 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()
Example #7
0
 async def f(rabbitmq_connection: aio_pika.Connection, weakset):
     async with rabbitmq_connection.channel() as channel:
         weakset.add(channel)
Example #8
0
async def channel(connection: aio_pika.Connection) -> aio_pika.Channel:
    async with connection.channel() as ch:
        await yield_(ch)