23 lines
597 B
Python
23 lines
597 B
Python
"""Shared fixtures and sys.path setup for all tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
# Ensure agent/ is on sys.path so imports like `backtest.*` and `src.*` work.
|
|
AGENT_DIR = Path(__file__).resolve().parent.parent
|
|
if str(AGENT_DIR) not in sys.path:
|
|
sys.path.insert(0, str(AGENT_DIR))
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _reset_env_config():
|
|
"""Clear the cached EnvConfig before each test so monkeypatch.setenv works."""
|
|
from src.config.accessor import reset_env_config
|
|
reset_env_config()
|
|
yield
|
|
reset_env_config()
|