Skip to content

The agent engineering platform.

fix integration test imports (#9669)

Bagatur342087bdfa3a
diff --git a/libs/langchain/tests/integration_tests/document_loaders/test_polars_dataframe.py b/libs/langchain/tests/integration_tests/document_loaders/test_polars_dataframe.py
index bd8e129daf..b9e4727d20 100644
--- a/libs/langchain/tests/integration_tests/document_loaders/test_polars_dataframe.py
+++ b/libs/langchain/tests/integration_tests/document_loaders/test_polars_dataframe.py
@@ -1,12 +1,18 @@
-import polars as pl
+from typing import TYPE_CHECKING
+
import pytest
from langchain.document_loaders import PolarsDataFrameLoader
from langchain.schema import Document
+if TYPE_CHECKING:
+ import polars as pl
+
@pytest.fixture
def sample_data_frame() -> pl.DataFrame:
+ import polars as pl
+
data = {
"text": ["Hello", "World"],
"author": ["Alice", "Bob"],
@@ -26,6 +32,8 @@ def test_load_returns_list_of_documents(sample_data_frame: pl.DataFrame) -> None
def test_load_converts_dataframe_columns_to_document_metadata(
sample_data_frame: pl.DataFrame,
) -> None:
+ import polars as pl
+
loader = PolarsDataFrameLoader(sample_data_frame)
docs = loader.load()
diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_epsilla.py b/libs/langchain/tests/integration_tests/vectorstores/test_epsilla.py
index af40d698bf..33e2e69523 100644
--- a/libs/langchain/tests/integration_tests/vectorstores/test_epsilla.py
+++ b/libs/langchain/tests/integration_tests/vectorstores/test_epsilla.py
@@ -1,6 +1,4 @@
"""Test Epsilla functionality."""
-from pyepsilla import vectordb
-
from langchain.vectorstores import Epsilla
from tests.integration_tests.vectorstores.fake_embeddings import (
FakeEmbeddings,
@@ -9,6 +7,8 @@ from tests.integration_tests.vectorstores.fake_embeddings import (
def _test_from_texts() -> Epsilla:
+ from pyepsilla import vectordb
+
embeddings = FakeEmbeddings()
client = vectordb.Client()
return Epsilla.from_texts(fake_texts, embeddings, client)
@@ -22,6 +22,8 @@ def test_epsilla() -> None:
def test_epsilla_add_texts() -> None:
+ from pyepsilla import vectordb
+
embeddings = FakeEmbeddings()
client = vectordb.Client()
db = Epsilla(client, embeddings)