"""Native overlay: leftover services src still imports resolve from src.""" from __future__ import annotations from pathlib import Path import backend.services.api_logs as api_logs import backend.services.billing_hook as billing_hook import backend.services.cost_estimator as cost_estimator import backend.services.datasheet_store as datasheet_store import backend.services.dedupe_findings as dedupe_findings import backend.services.digikey as digikey import backend.services.email as email import backend.services.normalize_findings as normalize_findings import backend.services.purple_parts as purple_parts import backend.services.storage as storage import backend.services.llm.base as llm_base import backend.services.llm.factory as llm_factory import backend.services.llm.types as llm_types def _src(mod) -> Path: return Path(mod.__file__).resolve() def test_leftover_services_load_from_src(): root = Path(__file__).resolve().parents[1] svc = (root / "periscope" / "src" / "backend" / "services").resolve() for mod, name in ( (api_logs, "api_logs.py"), (normalize_findings, "normalize_findings.py"), (dedupe_findings, "dedupe_findings.py"), (billing_hook, "billing_hook.py"), (datasheet_store, "datasheet_store.py"), (cost_estimator, "cost_estimator.py"), (storage, "storage.py"), (purple_parts, "purple_parts.py"), (email, "email.py"), (digikey, "digikey.py"), ): path = _src(mod) assert path == svc / name, path assert "Native Periscope overlay" in path.read_text(encoding="utf-8")[:500] def test_leftover_llm_factory_types_base_load_from_src(): root = Path(__file__).resolve().parents[1] llm = (root / "periscope" / "src" / "backend" / "services" / "llm").resolve() for mod, name in ( (llm_factory, "factory.py"), (llm_types, "types.py"), (llm_base, "base.py"), ): path = _src(mod) assert path == llm / name, path assert "Native Periscope overlay" in path.read_text(encoding="utf-8")[:500] def test_billing_hook_still_null_without_stripe(): from backend.services.billing_hook import InsufficientCredits, get_billing assert billing_hook.InsufficientCredits is InsufficientCredits billing = get_billing() assert billing.__class__.__name__ in {"NullBilling", "CreditsBilling"}