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

Function assert_mode_held

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

Source from the content-addressed store, hash-verified

21
22
23def assert_mode_held(lock_file: str, mode: Literal["read", "write"]) -> None:
24 contender = ReadWriteLock(lock_file, is_singleton=False)
25 acquire = getattr(contender, f"acquire_{OPPOSITE_MODE[mode]}")
26 with pytest.raises(Timeout):
27 acquire(blocking=False)
28 contender.close()
29
30
31async def can_write(lock: AsyncReadWriteLock) -> bool:

Calls 3

closeMethod · 0.95
ReadWriteLockClass · 0.90
acquireFunction · 0.50