updated tests
This commit is contained in:
@@ -1,28 +1,14 @@
|
||||
"""Integration tests configuration."""
|
||||
|
||||
import os
|
||||
from typing import Iterator
|
||||
from collections.abc 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
|
||||
# Import after environment is set by root conftest
|
||||
from baby_monitor.main import app
|
||||
|
||||
with TestClient(app) as client:
|
||||
|
||||
Reference in New Issue
Block a user