- Remove hardcoded FRED API key from autoresearch/prepare.py and thesis_portfolio_opt/research/experiment.py; load from .env via python-dotenv at module level instead - Add .env.example at root and update MiroFish/.env.example with CORS_ORIGINS and FRED_API_KEY documentation - Replace autoresearch/pyproject.toml: remove unused LLM deps (torch, rustbpe, tiktoken), add actual deps (scikit-learn, lightgbm, xgboost, fredapi, yfinance, cvxpy) - Fix PCA backtest bug in autoresearch/train.py: propagate fitted PCA/scaler transform through model dict so run_oos_backtest replays the same transform on live rows (B10 no longer crashes) - Fix MiroFish CORS wildcard: read allowed origins from CORS_ORIGINS env var, default to localhost dev origins - Add MiroFish test suite (36 tests): config validation, file parser, text processor, task manager, API health/blueprints - Pin upper bounds on thesis_portfolio_opt/requirements.txt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
import os
|
|
import sys
|
|
import pytest
|
|
|
|
# Ensure backend app is importable
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
|
|
|
# Set dummy env vars so Config doesn't fail during tests
|
|
os.environ.setdefault('LLM_API_KEY', 'test-key')
|
|
os.environ.setdefault('ZEP_API_KEY', 'test-key')
|
|
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
"""Create Flask test app."""
|
|
from app import create_app
|
|
application = create_app()
|
|
application.config['TESTING'] = True
|
|
return application
|
|
|
|
|
|
@pytest.fixture
|
|
def client(app):
|
|
"""Create Flask test client."""
|
|
return app.test_client()
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_text_file(tmp_path):
|
|
"""Create a temporary text file for parsing tests."""
|
|
p = tmp_path / "sample.txt"
|
|
p.write_text("Hello World.\nThis is a test document.\nThird line here.", encoding="utf-8")
|
|
return str(p)
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_md_file(tmp_path):
|
|
"""Create a temporary markdown file."""
|
|
p = tmp_path / "sample.md"
|
|
p.write_text("# Title\n\nParagraph one.\n\n## Section\n\nParagraph two.", encoding="utf-8")
|
|
return str(p)
|