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:
Christophe Bornet 2025-01-30 13:34:31 +01:00 committed by GitHub
commit 30c2fc159f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,6 @@
import asyncio
import inspect
from pathlib import Path
from typing import Any
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 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()
frontend_node: dict[str, Any] = {"outputs": []}
request = UpdateCustomComponentRequest(

View file

@ -13,7 +13,8 @@ from langflow.custom.utils import build_custom_component_template
@pytest.fixture
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)