1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-13 04:08:01 +01:00

fix(heatmap): interpolation thread is killed only on exit, logger for dandling thread

This commit is contained in:
2025-12-09 15:41:15 +01:00
parent f98a5de7e9
commit 6fc524c819
2 changed files with 24 additions and 14 deletions

View File

@@ -4,8 +4,8 @@ import numpy as np
import pytest
from bec_lib import messages
from bec_lib.scan_history import ScanHistory
from qtpy.QtGui import QTransform
from qtpy.QtCore import QPointF
from qtpy.QtGui import QTransform
from bec_widgets.widgets.plots.heatmap.heatmap import (
Heatmap,
@@ -560,8 +560,9 @@ def test_pending_request_queueing_and_start(heatmap_widget):
metadata={},
info={"positions": [[0, 0], [1, 1], [2, 2], [3, 3]]},
)
heatmap_widget._interpolation_thread = mock.MagicMock()
heatmap_widget._interpolation_thread.isRunning.return_value = True
# Simulate an active worker processing a job so new requests are queued.
heatmap_widget._interpolation_worker = mock.MagicMock()
heatmap_widget._interpolation_worker.is_processing = True
with mock.patch.object(heatmap_widget, "_start_step_scan_interpolation") as start_mock:
heatmap_widget._request_step_scan_interpolation(
@@ -573,7 +574,7 @@ def test_pending_request_queueing_and_start(heatmap_widget):
assert heatmap_widget._pending_interpolation_request is not None
# Now simulate worker finished and thread cleaned up
heatmap_widget._interpolation_thread = None
heatmap_widget._interpolation_worker.is_processing = False
pending = heatmap_widget._pending_interpolation_request
heatmap_widget._pending_interpolation_request = pending
heatmap_widget._maybe_start_pending_interpolation()