(lock_file: str, mode: Literal["read", "write"])
| 244 | @pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")]) |
| 245 | @pytest.mark.asyncio |
| 246 | async def test_nested_context_managers(lock_file: str, mode: Literal["read", "write"]) -> None: |
| 247 | lock = AsyncReadWriteLock(lock_file, is_singleton=False) |
| 248 | make_ctx = lock.read_lock if mode == "read" else lock.write_lock |
| 249 | async with make_ctx(): |
| 250 | assert_mode_held(lock_file, mode) |
| 251 | async with make_ctx(): |
| 252 | assert_mode_held(lock_file, mode) |
| 253 | assert_mode_held(lock_file, mode) |
| 254 | with pytest.raises(RuntimeError, match="not held"): |
| 255 | await lock.release() |
| 256 | await lock.close() |
| 257 | |
| 258 | |
| 259 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected