dec74a46d7
On-demand ?w= resize with a disk cache under webcache/; downloads stay full-resolution. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
1006 B
Python
29 lines
1006 B
Python
"""Shared test fixtures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def data_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
|
"""Point config path constants at a temporary data directory."""
|
|
variants = tmp_path / "variants"
|
|
intermediates = tmp_path / "intermediates"
|
|
meta = tmp_path / "meta"
|
|
inbox = tmp_path / "incoming"
|
|
webcache = tmp_path / "webcache"
|
|
for directory in (variants, intermediates, meta, inbox, webcache):
|
|
directory.mkdir()
|
|
|
|
monkeypatch.setattr("app.config.DATA_DIR", tmp_path)
|
|
monkeypatch.setattr("app.config.VARIANTS_DIR", variants)
|
|
monkeypatch.setattr("app.config.INTERMEDIATES_DIR", intermediates)
|
|
monkeypatch.setattr("app.config.META_DIR", meta)
|
|
monkeypatch.setattr("app.config.INBOX_DIR", inbox)
|
|
monkeypatch.setattr("app.config.WEB_CACHE_DIR", webcache)
|
|
monkeypatch.setattr("app.config.PROCESSED_FILE", tmp_path / "processed.json")
|
|
return tmp_path
|