Skip to content

Commit

Permalink
fix: Use relative paths for data files in unit tests (#6021)
Browse files Browse the repository at this point in the history
Use relative paths for data files in unit tests

Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
  • Loading branch information
cbornet and ogabrielluiz authored Jan 30, 2025
1 parent e09d3fe commit 30c2fc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/backend/tests/unit/api/v1/test_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import inspect
from pathlib import Path
from typing import Any

from aiofile import async_open
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion src/backend/tests/unit/test_custom_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

@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)


Expand Down

0 comments on commit 30c2fc1

Please sign in to comment.