import pytest from thoughtsync.config import Config @pytest.fixture(autouse=True) def _isolated_data_dir(tmp_path, monkeypatch): """Point DATA_DIR at a writable temp dir so create_app() can generate its signing key without needing /var/thoughtsync to exist (DB-free unit tests).""" data_dir = tmp_path / "data" monkeypatch.setattr(Config, "DATA_DIR", str(data_dir)) monkeypatch.setattr(Config, "MEDIA_ROOT", str(data_dir / "media")) yield