fix: Use relative paths for data files in unit tests (#6021)
Use relative paths for data files in unit tests Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
e09d3fe0bf
commit
30c2fc159f
2 changed files with 5 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import inspect
|
import inspect
|
||||||
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aiofile import async_open
|
from aiofile import async_open
|
||||||
|
|
@ -34,7 +35,8 @@ async def test_get_config(client: AsyncClient):
|
||||||
|
|
||||||
|
|
||||||
async def test_update_component_outputs(client: AsyncClient, logged_in_headers: dict):
|
async def test_update_component_outputs(client: AsyncClient, logged_in_headers: dict):
|
||||||
async with async_open("src/backend/tests/data/dynamic_output_component.py", encoding="utf-8") as f:
|
path = Path(__file__).parent.parent.parent.parent / "data" / "dynamic_output_component.py"
|
||||||
|
async with async_open(path, encoding="utf-8") as f:
|
||||||
code = await f.read()
|
code = await f.read()
|
||||||
frontend_node: dict[str, Any] = {"outputs": []}
|
frontend_node: dict[str, Any] = {"outputs": []}
|
||||||
request = UpdateCustomComponentRequest(
|
request = UpdateCustomComponentRequest(
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ from langflow.custom.utils import build_custom_component_template
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def code_component_with_multiple_outputs():
|
def code_component_with_multiple_outputs():
|
||||||
code = Path("src/backend/tests/data/component_multiple_outputs.py").read_text(encoding="utf-8")
|
path = Path(__file__).parent.parent / "data" / "component_multiple_outputs.py"
|
||||||
|
code = path.read_text(encoding="utf-8")
|
||||||
return Component(_code=code)
|
return Component(_code=code)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue