from mentor_pdf_export.scanner import scan_projects def test_scans_children_even_when_root_contains_project(project_factory, tmp_path): root = project_factory(".", "top") child = project_factory("nested", "child") assert {p.path for p in scan_projects(tmp_path)} == {root.resolve(), child.resolve()} def test_prunes_pcb_backups_and_output(project_factory, tmp_path): good = project_factory("good") project_factory("good/PCB", "fake") project_factory("ProjectBackup/old", "old") project_factory("output", "export_copy") project_factory("layout", "layout", schematic=False) assert [p.path for p in scan_projects(tmp_path)] == [good.resolve()] def test_explicit_excluded_root(project_factory, tmp_path): good = project_factory("good") project_factory("other") assert [p.path for p in scan_projects(tmp_path, excluded_roots=(tmp_path / "other",))] == [good.resolve()] def test_reads_actual_root_block(project_factory, tmp_path): project_factory() assert scan_projects(tmp_path)[0].root_blocks == ("ROOT",)