Skip to content

Commit b3f92ad

Browse files
tests: Added support for .env in integration tests (#128)
1 parent a272043 commit b3f92ad

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

libs/ibm/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ test = [
3636
"pytest>=8.4.0,<9.0.0",
3737
"freezegun>=1.2.2,<2.0.0",
3838
"pytest-mock>=3.10.0,<4.0.0",
39+
"pytest-dotenv>=0.5.2,<1.0.0",
3940
"syrupy>=4.0.2,<5.0.0",
4041
"pytest-watcher>=0.3.4,<0.4.0",
4142
"pytest-asyncio>=0.21.1,<1.0.0",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
WATSONX_APIKEY=watsonx_apikey
2+
WATSONX_PROJECT_ID=watsonx_project_id
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pathlib import Path
2+
3+
from dotenv import load_dotenv
4+
5+
# Getting the absolute path of the current file's directory
6+
ABS_PATH = (Path(__file__)).parent
7+
8+
# Getting the absolute path of the project's root directory
9+
PROJECT_DIR = Path(ABS_PATH).parent.parent
10+
11+
12+
def _load_env() -> None:
13+
dotenv_path = Path(PROJECT_DIR) / "tests" / "integration_tests" / ".env"
14+
if Path(dotenv_path).exists():
15+
load_dotenv(dotenv_path)
16+
17+
18+
_load_env()

libs/ibm/uv.lock

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)