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

Function test_lock_context_manager

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

Source from the content-addressed store, hash-verified

77@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])
78@pytest.mark.asyncio
79async def test_lock_context_manager(lock_file: str, mode: Literal["read", "write"]) -> None:
80 lock = AsyncReadWriteLock(lock_file, is_singleton=False)
81 async with getattr(lock, f"{mode}_lock")():
82 assert_mode_held(lock_file, mode)
83 with pytest.raises(RuntimeError, match="not held"):
84 await lock.release()
85 await lock.close()
86
87
88@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])

Callers

nothing calls this directly

Calls 4

AsyncReadWriteLockClass · 0.90
assert_mode_heldFunction · 0.90
releaseMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected