fix: include KiCad 10 Windows install paths in library auto-discovery
Some checks failed
CI/CD Pipeline / TypeScript Build & Test (20.x, macos-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, ubuntu-22.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, ubuntu-24.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, windows-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, macos-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, ubuntu-22.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, ubuntu-24.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, windows-latest) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.10) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.11) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.12) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.9) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.10) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.11) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.12) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.9) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (10.0) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (8.0) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (9.0) (push) Has been cancelled
CI/CD Pipeline / Docker Build Test (push) Has been cancelled
CI/CD Pipeline / Code Quality (push) Has been cancelled
CI/CD Pipeline / Documentation Check (push) Has been cancelled
Some checks failed
CI/CD Pipeline / TypeScript Build & Test (20.x, macos-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, ubuntu-22.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, ubuntu-24.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, windows-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, macos-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, ubuntu-22.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, ubuntu-24.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, windows-latest) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.10) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.11) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.12) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.9) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.10) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.11) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.12) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.9) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (10.0) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (8.0) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (9.0) (push) Has been cancelled
CI/CD Pipeline / Docker Build Test (push) Has been cancelled
CI/CD Pipeline / Code Quality (push) Has been cancelled
CI/CD Pipeline / Documentation Check (push) Has been cancelled
Fixes #245 — _find_kicad_footprint_dir() only listed the 9.0/8.0 Windows install paths, so a Windows host with only KiCad 10 installed got None and footprint auto-discovery found nothing. The same gap existed for symbols in library_symbol.py and dynamic_symbol_loader.py. - Add C:/Program Files/KiCad/10.0/share/kicad/{footprints,symbols} to the candidate lists (10.0 first, matching the existing newest-first order) - Honor KICAD10_FOOTPRINT_DIR and KICAD10_SYMBOL_DIR env overrides alongside the existing 9/8 ones - Regression tests in tests/test_kicad10_paths.py
This commit is contained in:
46
tests/test_kicad10_paths.py
Normal file
46
tests/test_kicad10_paths.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Regression tests for issue #245: KiCad 10 Windows install paths must be in
|
||||
the auto-discovery candidate lists (footprints and symbols), with env-var
|
||||
overrides for KiCad 10.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "python"))
|
||||
|
||||
from commands.library import LibraryManager # noqa: E402
|
||||
from commands.library_symbol import SymbolLibraryManager # noqa: E402
|
||||
|
||||
K10_FOOTPRINTS = "C:/Program Files/KiCad/10.0/share/kicad/footprints"
|
||||
K10_SYMBOLS = "C:/Program Files/KiCad/10.0/share/kicad/symbols"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestKicad10FootprintDir:
|
||||
def test_k10_windows_path_is_discovered(self):
|
||||
lm = LibraryManager.__new__(LibraryManager)
|
||||
with patch("commands.library.os.path.isdir", side_effect=lambda p: p == K10_FOOTPRINTS):
|
||||
assert lm._find_kicad_footprint_dir() == K10_FOOTPRINTS
|
||||
|
||||
def test_k10_env_override_wins(self, monkeypatch):
|
||||
lm = LibraryManager.__new__(LibraryManager)
|
||||
monkeypatch.setenv("KICAD10_FOOTPRINT_DIR", "/custom/k10/footprints")
|
||||
with patch("commands.library.os.path.isdir", return_value=True):
|
||||
assert lm._find_kicad_footprint_dir() == "/custom/k10/footprints"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestKicad10SymbolDir:
|
||||
def test_k10_windows_path_is_discovered(self):
|
||||
sm = SymbolLibraryManager.__new__(SymbolLibraryManager)
|
||||
with patch("commands.library_symbol.os.path.isdir", side_effect=lambda p: p == K10_SYMBOLS):
|
||||
assert sm._find_kicad_symbol_dir() == K10_SYMBOLS
|
||||
|
||||
def test_k10_env_override_wins(self, monkeypatch):
|
||||
sm = SymbolLibraryManager.__new__(SymbolLibraryManager)
|
||||
monkeypatch.setenv("KICAD10_SYMBOL_DIR", "/custom/k10/symbols")
|
||||
with patch("commands.library_symbol.os.path.isdir", return_value=True):
|
||||
assert sm._find_kicad_symbol_dir() == "/custom/k10/symbols"
|
||||
Reference in New Issue
Block a user