"""Native overlay: leftover PinScope modules src still imported resolve from src.""" from __future__ import annotations from pathlib import Path import backend.periscopex.bom_summary as bom_summary import backend.periscopex.derating as derating import backend.periscopex.led_current_check as led_current_check import backend.periscopex.pin_function_tokens as pin_function_tokens import backend.periscopex.pin_mux_check as pin_mux_check import backend.periscopex.resolve_passives as resolve_passives import backend.periscopex.utils as utils import backend.periscopex.validate as validate import backend.periscopex.validation_tools as validation_tools import backend.services.extraction as extraction import backend.services.pipeline as pipeline import backend.services.validation as validation from backend.repo_paths import skills_dir, taxonomy_dir def _src(mod) -> Path: return Path(mod.__file__).resolve() def test_leftover_periscopex_modules_load_from_src(): root = Path(__file__).resolve().parents[1] src = (root / "periscope" / "src" / "backend" / "periscopex").resolve() for mod, name in ( (utils, "utils.py"), (resolve_passives, "resolve_passives.py"), (derating, "derating.py"), (bom_summary, "bom_summary.py"), (pin_mux_check, "pin_mux_check.py"), (led_current_check, "led_current_check.py"), (pin_function_tokens, "pin_function_tokens.py"), (validate, "validate.py"), (validation_tools, "validation_tools.py"), ): path = _src(mod) assert path == src / name, path assert "Native Periscope overlay" in path.read_text(encoding="utf-8")[:500] def test_pipeline_extraction_validation_load_from_src(): root = Path(__file__).resolve().parents[1] src = (root / "periscope" / "src" / "backend" / "services").resolve() for mod, name in ( (pipeline, "pipeline.py"), (extraction, "extraction.py"), (validation, "validation.py"), ): path = _src(mod) assert path == src / name, path assert "Native Periscope overlay" in path.read_text(encoding="utf-8")[:500] def test_pipeline_still_reexports_job_workspace(): from backend.services.job_workspace import EventBroker, PipelineWorkspace assert pipeline.EventBroker is EventBroker assert pipeline.PipelineWorkspace is PipelineWorkspace assert pipeline.set_broker.__name__ == "set_broker" def test_native_taxonomy_and_skills_trees(): root = Path(__file__).resolve().parents[1] tax = taxonomy_dir() skills = skills_dir() assert (tax / "ic.json").is_file(), tax assert (skills / "extract-pintable" / "SKILL.md").is_file(), skills # Prefer src copies when not running in the Docker /app layout. if not Path("/app/taxonomy").is_dir(): assert tax == (root / "periscope" / "src" / "taxonomy").resolve() assert skills == (root / "periscope" / "src" / "skills").resolve()