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

Function test_reentrant

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

Source from the content-addressed store, hash-verified

88@pytest.mark.parametrize("mode", [pytest.param("read", id="read"), pytest.param("write", id="write")])
89@pytest.mark.asyncio
90async def test_reentrant(lock_file: str, mode: Literal["read", "write"]) -> None:
91 lock = AsyncReadWriteLock(lock_file, is_singleton=False)
92 acquire = getattr(lock, f"acquire_{mode}")
93 await acquire()
94 await acquire()
95 await lock.release()
96 assert_mode_held(lock_file, mode)
97 await lock.release()
98 with pytest.raises(RuntimeError, match="not held"):
99 await lock.release()
100 await lock.close()
101
102
103@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 5

AsyncReadWriteLockClass · 0.90
assert_mode_heldFunction · 0.90
acquireFunction · 0.50
releaseMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected