backend changes on test files of catalog

This commit is contained in:
sriram
2026-08-18 18:42:28 +05:30
parent 7a4583372f
commit a7a2430694
11 changed files with 98 additions and 7 deletions

View File

@@ -30,6 +30,19 @@ def _sheet(headers, rows) -> bytes:
return buf.getvalue()
@pytest.fixture(autouse=True)
def _isolate_sku_counter(tmp_path, monkeypatch):
"""Keep the SKU sequence counter out of the repo.
`sku_service` persists its per-brand counter to DATA_DIR/sku_sequences so
reruns keep issuing fresh numbers. Left alone, running the suite mutates a
real directory in the working tree; pointing it at tmp_path keeps each test
session self-contained and makes SKU numbering deterministic per test.
"""
from app.services import sku_service
monkeypatch.setattr(sku_service, "_data_dir", tmp_path / "sku_sequences")
@pytest.fixture
def store(monkeypatch):
"""A fake brand table. Returns the dict of image_id -> stored row."""