MCPcopy Create free account
hub / github.com/tox-dev/filelock / test_acquire_release

Function test_acquire_release

tests/test_async_read_write.py:39–46  ·  view source on GitHub ↗
(lock_file: str, mode: Literal["read", "write"])

Source from the content-addressed store, hash-verified

37@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])
38@pytest.mark.asyncio
39async def test_acquire_release(lock_file: str, mode: Literal["read", "write"]) -> None:
40 lock = AsyncReadWriteLock(lock_file, is_singleton=False)
41 proxy = await (lock.acquire_read() if mode == "read" else lock.acquire_write())
42 async with proxy as held:
43 assert held is lock
44 with pytest.raises(RuntimeError, match="not held"):
45 await lock.release()
46 await lock.close()
47
48
49@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])

Callers

nothing calls this directly

Calls 5

acquire_readMethod · 0.95
acquire_writeMethod · 0.95
releaseMethod · 0.95
closeMethod · 0.95
AsyncReadWriteLockClass · 0.90

Tested by

no test coverage detected