0979f506db
Add pytest infrastructure (pyproject.toml, conftest.py) and unit tests for modules that previously had zero test coverage: - test_schema_roundtrip.py: to_dict() serialization for all data classes - test_reddit_enrich.py: URL parsing, thread data parsing, comment filtering - test_reddit_sc.py: ScrapeCreators Reddit search (query expansion, subreddit discovery) - test_instagram_sc.py: Instagram relevance scoring, tokenization, depth config Includes fixtures/reddit_thread_sample.json for reddit_enrich tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
704 B
Python
34 lines
704 B
Python
"""Shared pytest fixtures for last30days tests."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def project_root():
|
|
"""Path to the repository root."""
|
|
return Path(__file__).parent.parent
|
|
|
|
|
|
@pytest.fixture
|
|
def fixtures_dir(project_root):
|
|
"""Path to the fixtures directory."""
|
|
return project_root / "fixtures"
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_config_dir(tmp_path):
|
|
"""Temporary directory for config file tests. Auto-cleaned by pytest."""
|
|
return tmp_path
|
|
|
|
|
|
@pytest.fixture
|
|
def load_fixture(fixtures_dir):
|
|
"""Load a JSON fixture file by name."""
|
|
def _load(name):
|
|
with open(fixtures_dir / name) as f:
|
|
return json.load(f)
|
|
return _load
|