Files
bindery/tests/conftest.py
T
tim c30622e3a0 Download stories and build epubs with FanFicFare
FanFicFare adapters fetch metadata and chapters, and its epub writer
builds each book from the store. Environment variables configure the
app, and a default personal.ini is copied to the config folder on first
start.
2026-09-27 23:38:28 +02:00

28 lines
693 B
Python

"""Point every directory at a temporary folder before the app modules load."""
import os
import tempfile
from pathlib import Path
_tmp = Path(tempfile.mkdtemp(prefix="bindery-tests-"))
for name, sub in [("CONFIG_DIR", "config"), ("INGEST_DIR", "ingest"), ("TMP_DIR", "tmp")]:
os.environ[name] = str(_tmp / sub)
os.environ["BINDERY_START_THREADS"] = "false"
os.environ["UPDATE_INTERVAL_HOURS"] = "0"
for name in (
"CWA_URL",
"CWA_USERNAME",
"CWA_PASSWORD",
"CWA_DB_PATH",
"CALIBRE_DB_PATH",
"AUTH_METHOD",
"BINDERY_API_KEY",
"URL_BASE",
"CWA_ALLOWED_USERS",
):
os.environ.pop(name, None)
from bindery import config # noqa: E402
config.prepare()