Skip to content

Commit

Permalink
partners/astradb: Add dotenv to langchain-astradb integration tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet authored Feb 16, 2024
1 parent 2a23971 commit 75465a2
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 6 deletions.
40 changes: 34 additions & 6 deletions libs/partners/astradb/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libs/partners/astradb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ optional = true

[tool.poetry.group.test.dependencies]
pytest = "^7.3.0"
pytest-dotenv = "^0.5.2"
freezegun = "^1.2.2"
pytest-mock = "^3.10.0"
syrupy = "^4.0.2"
Expand Down
5 changes: 5 additions & 0 deletions libs/partners/astradb/tests/integration_tests/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# astra db
ASTRA_DB_API_ENDPOINT=https://your_astra_db_id-your_region.apps.astra.datastax.com
ASTRA_DB_APPLICATION_TOKEN=AstraCS:your_astra_db_application_token
# ASTRA_DB_KEYSPACE=your_astra_db_namespace
# ASTRA_DB_SKIP_COLLECTION_DELETIONS=true
19 changes: 19 additions & 0 deletions libs/partners/astradb/tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Getting the absolute path of the current file's directory
import os

ABS_PATH = os.path.dirname(os.path.abspath(__file__))

# Getting the absolute path of the project's root directory
PROJECT_DIR = os.path.abspath(os.path.join(ABS_PATH, os.pardir, os.pardir))


# Loading the .env file if it exists
def _load_env() -> None:
dotenv_path = os.path.join(PROJECT_DIR, "tests", "integration_tests", ".env")
if os.path.exists(dotenv_path):
from dotenv import load_dotenv

load_dotenv(dotenv_path)


_load_env()

0 comments on commit 75465a2

Please sign in to comment.