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

Function test_acquire_release

tests/sqlite/test_async.py:67–74  ·  view source on GitHub ↗
(lock_file: str, mode: Literal["read", "write"])

Source from the content-addressed store, hash-verified

65@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])
66@pytest.mark.asyncio
67async def test_acquire_release(lock_file: str, mode: Literal["read", "write"]) -> None:
68 lock = AsyncReadWriteLock(lock_file, is_singleton=False)
69 proxy = await getattr(lock, f"acquire_{mode}")()
70 async with proxy as held:
71 assert held is lock
72 with pytest.raises(RuntimeError, match="not held"):
73 await lock.release()
74 await lock.close()
75
76
77@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])

Callers

nothing calls this directly

Calls 3

AsyncReadWriteLockClass · 0.90
releaseMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected