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

Function _run

tests/test_async_filelock.py:343–354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341def test_del_after_loop_close_does_not_raise(lock_type: type[BaseAsyncFileLock], tmp_path: Path) -> None:
342 # __del__ must not call get_running_loop() — it raises RuntimeError when no loop is running
343 def _run() -> None:
344 lock = lock_type(str(tmp_path / "test.lock"))
345 loop = asyncio.new_event_loop()
346 asyncio.set_event_loop(loop)
347 try:
348 loop.run_until_complete(lock.acquire())
349 loop.run_until_complete(lock.release(force=True))
350 finally:
351 loop.close()
352 asyncio.set_event_loop(None)
353 del lock
354 gc.collect()
355
356 with ThreadPoolExecutor(max_workers=1) as pool:
357 pool.submit(_run).result(timeout=10)

Callers

nothing calls this directly

Calls 3

acquireMethod · 0.45
releaseMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…