Skip to content

Commit

Permalink
Fix timing issue happening when trying to close message box not there…
Browse files Browse the repository at this point in the history
… yet
  • Loading branch information
DanSava committed Sep 20, 2023
1 parent c1ab4e6 commit c5c2a2c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/unit_tests/gui/test_rft_export_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ def test_rft_csv_export_plugin_exports_rft_data(

load_results_manually(qtbot, gui)

def handle_finished_box():
"""
Click on the plugin finished dialog once it pops up
"""
qtbot.waitUntil(lambda: isinstance(gui.findChild(QMessageBox), QMessageBox))

Check failure on line 101 in tests/unit_tests/gui/test_rft_export_plugin.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (88 > 79 characters)
finished_message = gui.findChild(QMessageBox)
assert isinstance(finished_message, QMessageBox)
assert "completed" in finished_message.text()
qtbot.mouseClick(finished_message.button(QMessageBox.Ok), Qt.LeftButton)

Check failure on line 105 in tests/unit_tests/gui/test_rft_export_plugin.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (84 > 79 characters)

def handle_rft_plugin_dialog():
qtbot.waitUntil(lambda: gui.findChild(CustomDialog) is not None)
dialog = gui.findChild(CustomDialog)
Expand All @@ -105,23 +115,13 @@ def handle_rft_plugin_dialog():
assert isinstance(list_field, ListEditBox)
list_field._list_edit_line.setText("default")
dialog.accept()

def handle_finished_box():
"""
Click on the plugin finished dialog once it pops up
"""
qtbot.waitUntil(lambda: isinstance(gui.findChild(QMessageBox), QMessageBox))
finished_message = gui.findChild(QMessageBox)
assert isinstance(finished_message, QMessageBox)
assert "completed" in finished_message.text()
qtbot.mouseClick(finished_message.button(QMessageBox.Ok), Qt.LeftButton)
QTimer.singleShot(3000, handle_finished_box)

plugin_actions = gui.tools["Plugins"].getAction().menu().actions()
rft_plugin = [
a for a in plugin_actions if a.iconText() == "GEN_DATA RFT CSV Export"

Check failure on line 122 in tests/unit_tests/gui/test_rft_export_plugin.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (82 > 79 characters)
][0]
QTimer.singleShot(500, handle_rft_plugin_dialog)
QTimer.singleShot(2000, handle_finished_box)
QTimer.singleShot(1000, handle_rft_plugin_dialog)
rft_plugin.trigger()
qtbot.waitUntil(output_file.exists, timeout=20000)
qtbot.waitUntil(
Expand Down

0 comments on commit c5c2a2c

Please sign in to comment.