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

Function test_reentrant

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

Source from the content-addressed store, hash-verified

61@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])
62@pytest.mark.asyncio
63async def test_reentrant(lock_file: str, mode: Literal["read", "write"]) -> None:
64 lock = AsyncReadWriteLock(lock_file, is_singleton=False)
65 acquire = lock.acquire_read if mode == "read" else lock.acquire_write
66 await acquire()
67 await acquire()
68 await lock.release()
69 assert_mode_held(lock_file, mode)
70 await lock.release()
71 with pytest.raises(RuntimeError, match="not held"):
72 await lock.release()
73 await lock.close()
74
75
76@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 5

releaseMethod · 0.95
closeMethod · 0.95
AsyncReadWriteLockClass · 0.90
assert_mode_heldFunction · 0.85
acquireFunction · 0.70

Tested by

no test coverage detected