fixed tests
Python Code Quality / python-code-quality (push) Successful in 9s
Python Test / python-test (push) Successful in 12s

This commit is contained in:
Brian Bjarke Jensen
2025-11-04 21:50:58 +01:00
parent 54f658d093
commit 298fb192de
7 changed files with 346 additions and 15 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Integration tests configuration."""
import os
from typing import Iterator
import pytest
from fastapi.testclient import TestClient
@pytest.fixture(scope="session", autouse=True)
def set_test_environment() -> Iterator[None]:
"""Set environment to development for all integration tests."""
original_env = os.environ.get("ENVIRONMENT")
os.environ["ENVIRONMENT"] = "development"
yield
# Cleanup: restore original environment
if original_env is None:
os.environ.pop("ENVIRONMENT", None)
else:
os.environ["ENVIRONMENT"] = original_env
@pytest.fixture(scope="session")
def app_test_client() -> Iterator[TestClient]:
"""Provides a TestClient for the FastAPI app."""
# Import here after environment is set
from baby_monitor.main import app
with TestClient(app) as client:
yield client