mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-05-19 21:06:58 +02:00
wip test client import fix
This commit is contained in:
@@ -8,8 +8,9 @@ from bec_widgets.utils.bec_connector import ConnectionConfig
|
||||
from bec_widgets.utils.bec_widget import BECWidget
|
||||
from bec_widgets.utils.colors import Colors, apply_theme
|
||||
from bec_widgets.widgets.plots.waveform.curve import CurveConfig
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
from tests.unit_tests.conftest import create_widget
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
|
||||
def test_color_validation_CSS():
|
||||
|
||||
@@ -7,8 +7,8 @@ from qtpy.QtGui import QTransform
|
||||
from bec_widgets.utils.crosshair import Crosshair
|
||||
from bec_widgets.widgets.plots.image.image_item import ImageItem
|
||||
from bec_widgets.widgets.plots.waveform.waveform import Waveform
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
# pylint: disable = redefined-outer-name
|
||||
@@ -214,7 +214,7 @@ def test_crosshair_clicked_signal(qtbot, plot_widget_with_crosshair):
|
||||
pos_in_widget = graphics_view.mapFromScene(pos_in_scene)
|
||||
|
||||
# Simulate mouse click
|
||||
qtbot.mouseClick(graphics_view.viewport(), Qt.LeftButton, pos=pos_in_widget)
|
||||
qtbot.mouseClick(graphics_view.viewport(), Qt.MouseButton.LeftButton, pos=pos_in_widget)
|
||||
|
||||
x, y = emitted_positions[0]
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@ from bec_widgets.widgets.plots.waveform.settings.curve_settings.curve_tree impor
|
||||
ScanIndexValidator,
|
||||
)
|
||||
from bec_widgets.widgets.plots.waveform.waveform import Waveform
|
||||
from tests.unit_tests.client_mocks import dap_plugin_message, mocked_client, mocked_client_with_dap
|
||||
from tests.unit_tests.conftest import create_widget
|
||||
|
||||
from .client_mocks import dap_plugin_message, mocked_client, mocked_client_with_dap
|
||||
from .conftest import create_widget
|
||||
|
||||
##################################################
|
||||
# CurveSetting
|
||||
|
||||
@@ -16,9 +16,7 @@ from bec_widgets.widgets.plots.heatmap.heatmap import (
|
||||
)
|
||||
|
||||
# pytest: disable=unused-import
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
|
||||
from .client_mocks import create_dummy_scan_item
|
||||
from .client_mocks import create_dummy_scan_item, mocked_client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -7,8 +7,9 @@ from qtpy.QtCore import QPointF, Qt
|
||||
from bec_widgets.widgets.plots.image.image import Image
|
||||
from bec_widgets.widgets.plots.image.setting_widgets.image_roi_tree import ROIPropertyTree
|
||||
from bec_widgets.widgets.plots.roi.image_roi import CircularROI, RectangularROI
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
from tests.unit_tests.conftest import create_widget
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -44,7 +45,7 @@ def test_initialization(roi_tree, image_widget):
|
||||
assert roi_tree.plot == image_widget.plot_item
|
||||
assert roi_tree.controller == image_widget.roi_controller
|
||||
assert isinstance(roi_tree.roi_items, dict)
|
||||
assert len(roi_tree.tree.findItems("", Qt.MatchContains)) == 0 # Empty tree initially
|
||||
assert len(roi_tree.tree.findItems("", Qt.MatchFlag.MatchContains)) == 0 # Empty tree initially
|
||||
|
||||
# Check toolbar actions
|
||||
assert roi_tree.toolbar.components.get_action("roi_rectangle")
|
||||
@@ -66,12 +67,16 @@ def test_controller_connection(roi_tree, image_widget):
|
||||
|
||||
# Verify that ROI was added to the tree
|
||||
assert roi in roi_tree.roi_items
|
||||
assert len(roi_tree.tree.findItems("test_roi", Qt.MatchExactly, roi_tree.COL_ROI)) == 1
|
||||
assert (
|
||||
len(roi_tree.tree.findItems("test_roi", Qt.MatchFlag.MatchExactly, roi_tree.COL_ROI)) == 1
|
||||
)
|
||||
|
||||
# Remove ROI via controller and check that it's removed from the tree
|
||||
image_widget.remove_roi(0)
|
||||
assert roi not in roi_tree.roi_items
|
||||
assert len(roi_tree.tree.findItems("test_roi", Qt.MatchExactly, roi_tree.COL_ROI)) == 0
|
||||
assert (
|
||||
len(roi_tree.tree.findItems("test_roi", Qt.MatchFlag.MatchExactly, roi_tree.COL_ROI)) == 0
|
||||
)
|
||||
|
||||
|
||||
def test_expand_collapse_tree(roi_tree, image_widget):
|
||||
|
||||
@@ -12,8 +12,9 @@ from bec_widgets.widgets.plots.roi.image_roi import (
|
||||
RectangularROI,
|
||||
ROIController,
|
||||
)
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
from tests.unit_tests.conftest import create_widget
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
|
||||
@pytest.fixture(params=["rect", "circle", "ellipse"])
|
||||
|
||||
@@ -5,8 +5,9 @@ from bec_lib.endpoints import MessageEndpoints
|
||||
from qtpy.QtCore import QPointF
|
||||
|
||||
from bec_widgets.widgets.plots.image.image import Image
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
from tests.unit_tests.conftest import create_widget
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
##################################################
|
||||
# Image widget base functionality tests
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from qtpy.QtTest import QSignalSpy
|
||||
|
||||
from bec_widgets.widgets.plots.motor_map.motor_map import MotorMap
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import numpy as np
|
||||
|
||||
from bec_widgets.widgets.plots.multi_waveform.multi_waveform import MultiWaveform
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
##################################################
|
||||
|
||||
@@ -8,7 +8,7 @@ from qtpy.QtCore import QEvent, QPoint, QPointF, Qt
|
||||
from qtpy.QtGui import QColor, QMouseEvent
|
||||
from qtpy.QtWidgets import QApplication
|
||||
|
||||
from bec_widgets.utils import Colors
|
||||
from bec_widgets.utils.colors import Colors
|
||||
from bec_widgets.widgets.progress.ring_progress_bar.ring_progress_bar import (
|
||||
RingProgressBar,
|
||||
RingProgressContainerWidget,
|
||||
|
||||
@@ -3,7 +3,8 @@ import pytest
|
||||
from bec_widgets.utils.settings_dialog import SettingsDialog
|
||||
from bec_widgets.widgets.progress.ring_progress_bar.ring_progress_bar import RingProgressBar
|
||||
from bec_widgets.widgets.progress.ring_progress_bar.ring_progress_settings_cards import RingSettings
|
||||
from tests.unit_tests.client_mocks import mocked_client
|
||||
|
||||
from .client_mocks import mocked_client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -10,8 +10,8 @@ from bec_widgets.widgets.plots.scatter_waveform.scatter_waveform import ScatterW
|
||||
from bec_widgets.widgets.plots.scatter_waveform.settings.scatter_curve_setting import (
|
||||
ScatterCurveSettings,
|
||||
)
|
||||
from tests.unit_tests.client_mocks import create_dummy_scan_item, mocked_client
|
||||
|
||||
from .client_mocks import create_dummy_scan_item, mocked_client
|
||||
from .conftest import create_widget
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ from bec_widgets.widgets.plots.waveform.waveform import Waveform
|
||||
from bec_widgets.widgets.services.scan_history_browser.scan_history_browser import (
|
||||
ScanHistoryBrowser,
|
||||
)
|
||||
from tests.unit_tests.client_mocks import (
|
||||
|
||||
from .client_mocks import (
|
||||
DummyData,
|
||||
create_dummy_scan_item,
|
||||
dap_plugin_message,
|
||||
@@ -26,7 +27,6 @@ from tests.unit_tests.client_mocks import (
|
||||
mocked_client,
|
||||
mocked_client_with_dap,
|
||||
)
|
||||
|
||||
from .conftest import create_widget
|
||||
|
||||
# pylint: disable=unexpected-keyword-arg
|
||||
|
||||
Reference in New Issue
Block a user