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

Function _run

tests/async_lock/test_finalization.py:42–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40def test_del_after_loop_close_does_not_raise(lock_type: type[BaseAsyncFileLock], tmp_path: Path) -> None:
41 # __del__ must not call get_running_loop(); it raises RuntimeError when no loop is running
42 def _run() -> None:
43 lock = lock_type(str(tmp_path / "test.lock"))
44 loop = asyncio.new_event_loop()
45 asyncio.set_event_loop(loop)
46 try:
47 loop.run_until_complete(lock.acquire())
48 loop.run_until_complete(lock.release(force=True))
49 finally:
50 loop.close()
51 asyncio.set_event_loop(None)
52 del lock
53 gc.collect()
54
55 with ThreadPoolExecutor(max_workers=1) as pool:
56 pool.submit(_run).result(timeout=10)

Callers

nothing calls this directly

Calls 4

lock_typeFunction · 0.85
acquireMethod · 0.45
releaseMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected