(lock_file: str, mode: Literal["read", "write"])
| 21 | |
| 22 | |
| 23 | def 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 | |
| 31 | async def can_write(lock: AsyncReadWriteLock) -> bool: |