(tmp_path: Path)
| 162 | |
| 163 | @pytest.mark.asyncio |
| 164 | async def test_coroutine_function(tmp_path: Path) -> None: |
| 165 | acquired = released = False |
| 166 | |
| 167 | class AioFileLock(BaseAsyncFileLock): |
| 168 | async def _acquire(self) -> None: # ty: ignore[invalid-method-override] |
| 169 | nonlocal acquired |
| 170 | acquired = True |
| 171 | self._context.lock_file_fd = 1 |
| 172 | |
| 173 | async def _release(self) -> None: # ty: ignore[invalid-method-override] |
| 174 | nonlocal released |
| 175 | released = True |
| 176 | self._context.lock_file_fd = None |
| 177 | |
| 178 | lock = AioFileLock(str(tmp_path / "a")) |
| 179 | await lock.acquire() |
| 180 | assert acquired |
| 181 | assert not released |
| 182 | await lock.release() |
| 183 | assert acquired |
| 184 | assert released |
| 185 | |
| 186 | |
| 187 | @pytest.mark.parametrize("lock_type", [AsyncFileLock, AsyncSoftFileLock]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…