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

Function run

tests/sqlite/test_async_executor.py:124–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122@pytest.mark.parametrize("shut_down", [pytest.param(False, id="available"), pytest.param(True, id="shut-down")])
123def test_close_leaves_the_default_executor_idle(lock_file: str, *, shut_down: bool) -> None:
124 async def run() -> None:
125 started = threading.Event()
126 loop = asyncio.get_running_loop()
127 loop.set_default_executor(ThreadPoolExecutor(max_workers=1, initializer=started.set))
128 lock = AsyncReadWriteLock(lock_file, is_singleton=False)
129 worker = await asyncio.wrap_future(lock.executor.submit(threading.current_thread))
130 if shut_down:
131 await loop.shutdown_default_executor()
132 await lock.close()
133
134 assert not worker.is_alive()
135 assert not started.is_set()
136
137 asyncio.run(run())
138

Calls 3

AsyncReadWriteLockClass · 0.90
submitMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected