from __future__ import annotations from pathlib import Path import pytest from tenbackward.config import Config @pytest.fixture() def env_setup(monkeypatch: pytest.MonkeyPatch) -> None: """Provide a fully populated environment for Config success paths. Tests that exercise the missing-required-key path should call `monkeypatch.delenv(...)` explicitly. """ monkeypatch.setenv("MASTODON_BASE_URL", "https://mastodon.example") monkeypatch.setenv("MASTODON_ACCESS_TOKEN", "test-token") monkeypatch.setenv("SITE_URL", "https://blog.example.com") monkeypatch.setenv("HASHTAGS", "#throwback,#10backward") monkeypatch.setenv("RUN_AT", "09:00") @pytest.fixture() def data_dir(tmp_path: Path) -> Path: return tmp_path / "data" @pytest.fixture() def full_config(env_setup, data_dir) -> Config: """Build a Config object that points at an isolated data dir.""" from tenbackward.config import load_config import os os.environ["DATA_DIR"] = str(data_dir) return load_config()