Skip to content

Commit

Permalink
TST: Try destroying signals to avoid signal-callback triggering qt ca…
Browse files Browse the repository at this point in the history
…llbacks
  • Loading branch information
tangkong committed Oct 3, 2023
1 parent e1c04c8 commit e15a50b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions atef/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit e15a50b

Please sign in to comment.