ref: Remove some useless asyncio.to_thread (#5149)
Remove some useless asyncio.to_thread
This commit is contained in:
parent
0b39554795
commit
c0b25fa651
10 changed files with 44 additions and 94 deletions
|
|
@ -1,18 +1,11 @@
|
|||
import asyncio
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from aiofile import async_open
|
||||
from fastapi import status
|
||||
from httpx import AsyncClient
|
||||
from langflow.api.v1.schemas import UpdateCustomComponentRequest
|
||||
|
||||
|
||||
async def get_dynamic_output_component_code():
|
||||
return await asyncio.to_thread(
|
||||
Path("src/backend/tests/data/dynamic_output_component.py").read_text, encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
async def test_get_version(client: AsyncClient):
|
||||
response = await client.get("api/v1/version")
|
||||
result = response.json()
|
||||
|
|
@ -37,7 +30,8 @@ async def test_get_config(client: AsyncClient):
|
|||
|
||||
|
||||
async def test_update_component_outputs(client: AsyncClient, logged_in_headers: dict):
|
||||
code = await get_dynamic_output_component_code()
|
||||
async with async_open("src/backend/tests/data/dynamic_output_component.py", encoding="utf-8") as f:
|
||||
code = await f.read()
|
||||
frontend_node: dict[str, Any] = {"outputs": []}
|
||||
request = UpdateCustomComponentRequest(
|
||||
code=code,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue