fix: Enhance tests and update NVIDIA Ingest installation instructions (#6753)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-02-21 11:05:29 -03:00 committed by GitHub
commit 3940e8a94a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 11 deletions

View file

@ -24,7 +24,7 @@ class NvidiaIngestComponent(Component):
except ImportError:
msg = (
"NVIDIA Ingest dependencies missing. "
"Please install them using your package manager. (e.g. uv sync --extra nv-ingest)"
"Please install them using your package manager. (e.g. uv pip install langflow[nv-ingest])"
)
logger.warning(msg)
file_types = [msg]
@ -126,7 +126,7 @@ class NvidiaIngestComponent(Component):
except ImportError as e:
msg = (
"NVIDIA Ingest dependencies missing. "
"Please install them using your package manager. (e.g. uv sync --extra nv-ingest)"
"Please install them using your package manager. (e.g. uv pip install langflow[nv-ingest])"
)
raise ImportError(msg) from e

View file

@ -1,6 +1,3 @@
import asyncio
from pathlib import Path
import anyio
from aiofile import async_open
from loguru import logger
@ -91,9 +88,8 @@ class LocalStorageService(StorageService):
msg = f"Flow {flow_id} directory does not exist."
raise FileNotFoundError(msg)
files = [
file.name for file in await asyncio.to_thread(Path(folder_path).iterdir) if await anyio.Path(file).is_file()
]
files = [file.name async for file in anyio.Path(folder_path).iterdir() if await anyio.Path(file).is_file()]
logger.info(f"Listed {len(files)} files in flow {flow_id}.")
return files

View file

@ -401,8 +401,9 @@ async def client_fixture(
@pytest.fixture
def runner():
return CliRunner()
def runner(tmp_path):
env = {"LANGFLOW_DATABASE_URL": f"sqlite:///{tmp_path}/test.db"}
return CliRunner(env=env)
@pytest.fixture

View file

@ -199,7 +199,7 @@ async def test_list_files(files_client, files_created_api_key, files_flow):
# Then list the files
response = await files_client.get(f"api/v1/files/list/{files_flow.id}", headers=headers)
assert response.status_code == 200
assert response.status_code == 200, f"Expected 200, got {response.status_code}: {response.json()}"
files = response.json()["files"]
assert len(files) == 1
assert files[0].endswith("test.txt")

View file

@ -144,6 +144,7 @@ def test_that_outputs_cache_is_set_to_false_in_cycle():
assert output.cache is True
@pytest.mark.skip(reason="Cycles should have a `allows_loop` Output to work.")
@pytest.mark.skipif(not os.getenv("OPENAI_API_KEY"), reason="OpenAI API key required")
def test_updated_graph_with_prompts():
# Chat input initialization
@ -212,6 +213,7 @@ def test_updated_graph_with_prompts():
assert "chat_output_1" in results_ids, f"Expected outputs not in results: {results_ids}"
@pytest.mark.skip(reason="Cycles should have a `allows_loop` Output to work.")
@pytest.mark.skipif(not os.getenv("OPENAI_API_KEY"), reason="OpenAI API key required")
def test_updated_graph_with_max_iterations():
# Chat input initialization