(
request: pytest.FixtureRequest, tmp_path: Path, make: _Make
)
| 264 | |
| 265 | @pytest_asyncio.fixture(loop_scope="function") |
| 266 | async def closing_worker( |
| 267 | request: pytest.FixtureRequest, tmp_path: Path, make: _Make |
| 268 | ) -> AsyncIterator[tuple[AsyncReadWriteLock | AsyncSoftReadWriteLock, threading.Thread, threading.Event]]: |
| 269 | sync, lock = make(tmp_path, is_singleton=True) |
| 270 | if request.param == "retire": |
| 271 | await lock.acquire_write() |
| 272 | worker = await asyncio.wrap_future(lock.executor.submit(threading.current_thread)) |
| 273 | resume = threading.Event() |
| 274 | lock.executor.submit(resume.wait, 5) |
| 275 | closing = asyncio.create_task(lock.close()) |
| 276 | try: |
| 277 | await asyncio.sleep(0) |
| 278 | if request.param == "retry": |
| 279 | closing.cancel() |
| 280 | with pytest.raises(asyncio.CancelledError): |
| 281 | await closing |
| 282 | yield lock, worker, resume |
| 283 | finally: |
| 284 | resume.set() |
| 285 | with suppress(asyncio.CancelledError): |
| 286 | await closing |
| 287 | sync.close() |
nothing calls this directly
no test coverage detected