diff --git a/test/test_health_monitor.py b/test/test_health_monitor.py index f8427476..41a6206a 100644 --- a/test/test_health_monitor.py +++ b/test/test_health_monitor.py @@ -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() diff --git a/test/test_scroll_helper.py b/test/test_scroll_helper.py index 30e76b9c..517d3e47 100644 --- a/test/test_scroll_helper.py +++ b/test/test_scroll_helper.py @@ -224,7 +224,7 @@ class TestCalculateDynamicDuration: assert result >= 60 def test_respects_max_duration(self, helper): - helper.create_scrolling_image([_make_image(width=50000)]) + helper.create_scrolling_image([_make_image(width=5000)]) helper.min_duration = 10 helper.max_duration = 60 helper.scroll_speed = 1.0 # very slow → very long time