From e15a50be7ccb90cd734b627657c398651873e19a Mon Sep 17 00:00:00 2001 From: tangkong Date: Mon, 2 Oct 2023 16:55:51 -0700 Subject: [PATCH] TST: Try destroying signals to avoid signal-callback triggering qt callbacks --- atef/tests/test_widgets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/atef/tests/test_widgets.py b/atef/tests/test_widgets.py index dcfd32c9..b1f49ac4 100644 --- a/atef/tests/test_widgets.py +++ b/atef/tests/test_widgets.py @@ -9,6 +9,7 @@ from pytestqt.qtbot import QtBot from qtpy import QtCore +from atef.cache import get_signal_cache from atef.widgets.happi import HappiDeviceComponentWidget from atef.widgets.ophyd import OphydDeviceTableWidget @@ -200,14 +201,13 @@ def test_config_window_basic(qtbot: QtBot): qtbot.addWidget(window) -# @pytest.mark.parametrize('config', [0, 1, 2], indirect=True) +# @pytest.mark.skip() def test_config_window_save_load(qtbot: QtBot, tmp_path: pathlib.Path, all_config_path: os.PathLike): """ Pass if the config gui can open a file and save the same file back """ window = Window(show_welcome=False) - qtbot.addWidget(window) config = pathlib.Path(all_config_path) filename = config.name source = str(config) @@ -219,6 +219,10 @@ def test_config_window_save_load(qtbot: QtBot, tmp_path: pathlib.Path, with open(dest, 'r') as fd: dest_lines = fd.readlines() assert source_lines == dest_lines + # Clear the signal cache to stop signal-based callbacks from triggering + cache = get_signal_cache() + cache.clear() + qtbot.addWidget(window) # # Test encountered frequent failures due to C++ objects being deleted before