Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Dec 13, 2024
1 parent 90c1cc6 commit eeff780
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions libs/mongodb/tests/integration_tests/test_parent_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
def embedding_model() -> Embeddings:
from langchain_openai import OpenAIEmbeddings

try:
return OpenAIEmbeddings(
openai_api_key=os.environ["OPENAI_API_KEY"], # type: ignore # noqa
model="text-embedding-3-small",
)
except Exception:
if not os.environ.get("OPENAI_API_KEY"):
return ConsistentFakeEmbeddings(DIMENSIONS)
return OpenAIEmbeddings(
openai_api_key=os.environ["OPENAI_API_KEY"], # type: ignore # noqa
model="text-embedding-3-small",
)


def test_1clxn_retriever(
Expand Down
4 changes: 2 additions & 2 deletions libs/mongodb/tests/integration_tests/test_retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def example_documents() -> List[Document]:
def embedding_openai() -> Embeddings:
from langchain_openai import OpenAIEmbeddings

if os.environ.get("OPENAI_API_KEY") is None:
pytest.skip("test_retrievers expects OPENAI_API_KEY in os.environ")
if not os.environ.get("OPENAI_API_KEY"):
pytest.skip("test_retrievers expects OPENAI_API_KEY in os.environ")

from langchain_openai import OpenAIEmbeddings

Check failure on line 53 in libs/mongodb/tests/integration_tests/test_retrievers.py

View workflow job for this annotation

GitHub Actions / cd libs/mongodb / make lint #3.9

Ruff (F811)

tests/integration_tests/test_retrievers.py:53:34: F811 Redefinition of unused `OpenAIEmbeddings` from line 48

Check failure on line 53 in libs/mongodb/tests/integration_tests/test_retrievers.py

View workflow job for this annotation

GitHub Actions / cd libs/mongodb / make lint #3.12

Ruff (F811)

tests/integration_tests/test_retrievers.py:53:34: F811 Redefinition of unused `OpenAIEmbeddings` from line 48

Expand Down

0 comments on commit eeff780

Please sign in to comment.