Finance-Accounts/ar-aging-app/backend/tests/conftest.py

37 lines
1.1 KiB
Python

"""Shared test fixtures. Locates the Jan-2026 sample files (large; integration tests)."""
from __future__ import annotations
import os
from pathlib import Path
import pytest
# Default: the project root two levels above ar-aging-app/backend.
_DEFAULT_SAMPLE_DIR = Path(__file__).resolve().parents[3]
SAMPLE_DIR = Path(os.environ.get("AR_SAMPLE_DIR", str(_DEFAULT_SAMPLE_DIR)))
JAN_FILES = [
"USA Amazon Transactions 01 to 10 January,2026.xlsx",
"USA Amazon Transactions 11 to 20 January,2026.xlsx",
"USA Amazon Transactions 21 to 31 January,2026.xlsx",
]
SAMPLE_WORKBOOK = "Accounts Receivable Aging (Jan-26) 1.xlsx"
@pytest.fixture(scope="session")
def jan_files() -> list[str]:
paths = [str(SAMPLE_DIR / f) for f in JAN_FILES]
missing = [p for p in paths if not os.path.exists(p)]
if missing:
pytest.skip(f"Sample Jan-2026 files not found: {missing}")
return paths
@pytest.fixture(scope="session")
def sample_workbook() -> str:
p = str(SAMPLE_DIR / SAMPLE_WORKBOOK)
if not os.path.exists(p):
pytest.skip(f"Sample workbook not found: {p}")
return p