Skip to content

Commit 5c0953b

Browse files
committed
fix lint
1 parent 4f8bdaf commit 5c0953b

File tree

6 files changed

+30
-18
lines changed

6 files changed

+30
-18
lines changed

tests/test_async_chatmessagehistory.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
# Helper to bridge the Main Test Loop and the Engine Background Loop
3939
async def run_on_background(engine: PostgresEngine, coro: Coroutine) -> Any:
4040
"""Runs a coroutine on the engine's background loop."""
41-
return await asyncio.wrap_future(
42-
asyncio.run_coroutine_threadsafe(coro, engine._loop)
43-
)
41+
if engine._loop:
42+
return await asyncio.wrap_future(
43+
asyncio.run_coroutine_threadsafe(coro, engine._loop)
44+
)
45+
return await coro
4446

4547

4648
async def aexecute(engine: PostgresEngine, query: str) -> None:

tests/test_async_checkpoint.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ def _AnyIdToolMessage(**kwargs: Any) -> ToolMessage:
111111
# Helper to bridge the Main Test Loop and the Engine Background Loop
112112
async def run_on_background(engine: PostgresEngine, coro: Coroutine) -> Any:
113113
"""Runs a coroutine on the engine's background loop."""
114-
return await asyncio.wrap_future(
115-
asyncio.run_coroutine_threadsafe(coro, engine._loop)
116-
)
114+
if engine._loop:
115+
return await asyncio.wrap_future(
116+
asyncio.run_coroutine_threadsafe(coro, engine._loop)
117+
)
118+
return await coro
117119

118120

119121
async def aexecute(engine: PostgresEngine, query: str) -> None:

tests/test_async_loader.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@
3939
# Helper to bridge the Main Test Loop and the Engine Background Loop
4040
async def run_on_background(engine: PostgresEngine, coro: Coroutine) -> Any:
4141
"""Runs a coroutine on the engine's background loop."""
42-
return await asyncio.wrap_future(
43-
asyncio.run_coroutine_threadsafe(coro, engine._loop)
44-
)
42+
if engine._loop:
43+
return await asyncio.wrap_future(
44+
asyncio.run_coroutine_threadsafe(coro, engine._loop)
45+
)
46+
return await coro
4547

4648

4749
async def aexecute(engine: PostgresEngine, query: str) -> None:

tests/test_async_vectorstore.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ def get_env_var(key: str, desc: str) -> str:
5454
# Helper to bridge the Main Test Loop and the Engine Background Loop
5555
async def run_on_background(engine: PostgresEngine, coro: Coroutine) -> Any:
5656
"""Runs a coroutine on the engine's background loop."""
57-
return await asyncio.wrap_future(
58-
asyncio.run_coroutine_threadsafe(coro, engine._loop)
59-
)
57+
if engine._loop:
58+
return await asyncio.wrap_future(
59+
asyncio.run_coroutine_threadsafe(coro, engine._loop)
60+
)
61+
return await coro
6062

6163

6264
async def aexecute(engine: PostgresEngine, query: str) -> None:

tests/test_async_vectorstore_from_methods.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ def get_env_var(key: str, desc: str) -> str:
5555
# Helper to bridge the Main Test Loop and the Engine Background Loop
5656
async def run_on_background(engine: PostgresEngine, coro: Coroutine) -> Any:
5757
"""Runs a coroutine on the engine's background loop."""
58-
return await asyncio.wrap_future(
59-
asyncio.run_coroutine_threadsafe(coro, engine._loop)
60-
)
58+
if engine._loop:
59+
return await asyncio.wrap_future(
60+
asyncio.run_coroutine_threadsafe(coro, engine._loop)
61+
)
62+
return await coro
6163

6264

6365
async def aexecute(engine: PostgresEngine, query: str) -> None:

tests/test_async_vectorstore_index.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ def get_env_var(key: str, desc: str) -> str:
6565
# Helper to bridge the Main Test Loop and the Engine Background Loop
6666
async def run_on_background(engine: PostgresEngine, coro: Coroutine) -> Any:
6767
"""Runs a coroutine on the engine's background loop."""
68-
return await asyncio.wrap_future(
69-
asyncio.run_coroutine_threadsafe(coro, engine._loop)
70-
)
68+
if engine._loop:
69+
return await asyncio.wrap_future(
70+
asyncio.run_coroutine_threadsafe(coro, engine._loop)
71+
)
72+
return await coro
7173

7274

7375
async def aexecute(engine: PostgresEngine, query: str) -> None:

0 commit comments

Comments
 (0)