Add config and client injection with test reorganization.

Introduce typed config objects, optional adapter injection, and .env loading to simplify testing while preserving env-based defaults for production usage.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Brian Bjarke Jensen
2026-07-06 20:44:08 +02:00
co-authored by Cursor
parent 366831ac52
commit 7991dabdbc
28 changed files with 645 additions and 377 deletions
+26
View File
@@ -0,0 +1,26 @@
"""Unit tests for dotenv_loader."""
from __future__ import annotations
import os
from pathlib import Path
import pytest
from python_repositories.config.dotenv_loader import load_dotenv
def test_load_dotenv_loads_file(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
env_file = tmp_path / ".env"
env_file.write_text("DOTENV_TEST_VAR=loaded_value\n")
monkeypatch.delenv("DOTENV_TEST_VAR", raising=False)
loaded = load_dotenv(env_file)
assert loaded is True
assert os.getenv("DOTENV_TEST_VAR") == "loaded_value"
def test_load_dotenv_returns_false_for_missing_file(tmp_path: Path) -> None:
missing = tmp_path / "missing.env"
assert load_dotenv(missing) is False