Exemple #1
0
async def test_channel_lock_context_manager_no_channel_lock(
        async_transport_no_abc):
    base_channel_args = BaseChannelArgs(channel_lock=False)
    async_channel = AsyncChannel(transport=async_transport_no_abc,
                                 base_channel_args=base_channel_args)
    async with async_channel._channel_lock():
        assert True
Exemple #2
0
async def test_channel_lock_context_manager(async_transport_no_abc):
    base_channel_args = BaseChannelArgs(channel_lock=True)
    async_channel = AsyncChannel(transport=async_transport_no_abc,
                                 base_channel_args=base_channel_args)
    assert async_channel.channel_lock.locked() is False
    async with async_channel._channel_lock():
        assert async_channel.channel_lock.locked() is True
    assert async_channel.channel_lock.locked() is False