Files
kicad-mcp-server/tests
Lucas Pirola 6282091ed4 test: make collision-warning test robust to basicConfig(force=True)
test_handler_logs_warning_on_collision relied on pytest's caplog, but the
package calls logging.basicConfig(..., force=True) at import time (the
rotating-file logging added in #181). force=True detaches the root handler
that caplog reads from, so the emitted warning was routed to the stderr/file
handlers but never reached caplog.records — the final assertion failed
depending on import/handler ordering.

Capture on the "kicad_interface" logger with a test-owned handler instead of
relying on caplog, and disable propagation for the duration so the warning no
longer leaks to stderr. Logger level and propagation are restored in a finally
block. Behaviour under test is unchanged; the assertion is now deterministic.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 21:50:06 +04:00
..