mirror of
https://github.com/hoshikawa2/compass_backoffice.git
synced 2026-07-09 22:04:20 +00:00
first commit
This commit is contained in:
37
tests_original_develop/conftest.py
Normal file
37
tests_original_develop/conftest.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
Pytest configuration and fixtures for all tests.
|
||||
"""
|
||||
|
||||
# Stub google.cloud.pubsub_v1 BEFORE any other import. `agent_framework`
|
||||
# (private TIM package) instantiates a PublisherClient at import time,
|
||||
# which requires GCloud creds; tests run without those.
|
||||
import sys as _sys
|
||||
from unittest.mock import MagicMock as _MagicMock
|
||||
_sys.modules.setdefault("google.cloud.pubsub_v1", _MagicMock())
|
||||
|
||||
# Load .env BEFORE any other import so that Settings fields that call
|
||||
# os.environ[] at class-definition time (e.g. TAIS_DB_DSN) are satisfied.
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
import os
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def setup_test_environment():
|
||||
"""
|
||||
Set up environment variables for testing.
|
||||
|
||||
This fixture runs once per test session and sets required
|
||||
environment variables to allow config module to load.
|
||||
"""
|
||||
# Set required environment variables for Settings
|
||||
os.environ.setdefault("LLM_PROVIDER", "openai")
|
||||
os.environ.setdefault("LLM_MODEL", "gpt-4")
|
||||
os.environ.setdefault("LOG_LEVEL", "INFO")
|
||||
os.environ.setdefault("LOG_FORMAT", "text")
|
||||
|
||||
yield
|
||||
|
||||
# Cleanup is not needed as these are just defaults
|
||||
Reference in New Issue
Block a user