test(symbol-library): init _cache_lock in __new__-based fixture

The background warm-cache change made list_symbols() guard cache writes with
self._cache_lock. _manager_for_fixture() builds the manager via __new__ (to skip
disk I/O to system libs), bypassing __init__ where the lock is created, so the 8
SPICE-parsing tests raised AttributeError. Set the lock in the fixture. The
string-aware parser itself is correct — all 8 pass once the lock exists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
mixelpixx
2026-05-30 08:51:46 -04:00
parent 36820d6897
commit 4a61ad233d

View File

@@ -7,6 +7,7 @@ Covers:
""" """
import sys import sys
import threading
from pathlib import Path from pathlib import Path
import pytest import pytest
@@ -24,6 +25,9 @@ def _manager_for_fixture() -> SymbolLibraryManager:
manager.project_path = None manager.project_path = None
manager.libraries = {"Simulation_SPICE": str(FIXTURE)} manager.libraries = {"Simulation_SPICE": str(FIXTURE)}
manager.symbol_cache = {} manager.symbol_cache = {}
# list_symbols() guards cache writes with this lock (added alongside the
# background warm-cache). The fixture bypasses __init__, so set it here.
manager._cache_lock = threading.Lock()
return manager return manager