mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-05-25 05:43:31 +00:00
fix(tests): thread cleanup on assertion failure, reduce oversized image
- test_health_monitor.py: wrap start_monitoring calls in try/finally so the background thread is always stopped even when an assertion fails - test_scroll_helper.py: reduce 50,000px test image to 5,000px to avoid unnecessary memory pressure on Raspberry Pi Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -280,9 +280,11 @@ class TestGetRecoverySuggestions:
|
||||
class TestMonitorLifecycle:
|
||||
def test_start_monitoring(self, monitor):
|
||||
monitor.start_monitoring()
|
||||
assert monitor._monitor_thread is not None
|
||||
assert monitor._monitor_thread.is_alive()
|
||||
monitor.stop_monitoring()
|
||||
try:
|
||||
assert monitor._monitor_thread is not None
|
||||
assert monitor._monitor_thread.is_alive()
|
||||
finally:
|
||||
monitor.stop_monitoring()
|
||||
|
||||
def test_stop_monitoring(self, monitor):
|
||||
monitor.start_monitoring()
|
||||
@@ -292,10 +294,12 @@ class TestMonitorLifecycle:
|
||||
|
||||
def test_double_start_no_duplicate_threads(self, monitor):
|
||||
monitor.start_monitoring()
|
||||
thread1 = monitor._monitor_thread
|
||||
monitor.start_monitoring() # should be idempotent
|
||||
assert monitor._monitor_thread is thread1
|
||||
monitor.stop_monitoring()
|
||||
try:
|
||||
thread1 = monitor._monitor_thread
|
||||
monitor.start_monitoring() # should be idempotent
|
||||
assert monitor._monitor_thread is thread1
|
||||
finally:
|
||||
monitor.stop_monitoring()
|
||||
|
||||
def test_register_health_check(self, monitor):
|
||||
callback = MagicMock()
|
||||
|
||||
Reference in New Issue
Block a user