|
8 | 8 |
|
9 | 9 | import numpy as np
|
10 | 10 | import pytest
|
11 |
| -from pytestqt.qtbot import QtBot |
12 | 11 | from qtpy.QtCore import Qt, QTimer
|
13 | 12 | from qtpy.QtWidgets import (
|
14 | 13 | QAction,
|
15 | 14 | QCheckBox,
|
16 | 15 | QComboBox,
|
17 | 16 | QDoubleSpinBox,
|
18 | 17 | QMenuBar,
|
19 |
| - QMessageBox, |
20 | 18 | QPushButton,
|
21 | 19 | QToolButton,
|
22 | 20 | QTreeView,
|
|
34 | 32 | from ert.gui.main import ErtMainWindow, GUILogHandler, _setup_main_window
|
35 | 33 | from ert.gui.simulation.experiment_panel import ExperimentPanel
|
36 | 34 | from ert.gui.simulation.run_dialog import RunDialog
|
37 |
| -from ert.gui.simulation.view import RealizationWidget |
38 | 35 | from ert.gui.suggestor import Suggestor
|
39 | 36 | from ert.gui.suggestor._suggestor_message import SuggestorMessage
|
40 | 37 | from ert.gui.tools.event_viewer import add_gui_log_handler
|
41 |
| -from ert.gui.tools.file.file_dialog import FileDialog |
42 | 38 | from ert.gui.tools.manage_experiments import (
|
43 | 39 | ManageExperimentsPanel,
|
44 | 40 | )
|
|
57 | 53 | SingleTestRun,
|
58 | 54 | )
|
59 | 55 | from ert.services import StorageService
|
60 |
| -from ert.storage import open_storage |
61 | 56 |
|
62 | 57 | from .conftest import (
|
63 | 58 | add_experiment_manually,
|
@@ -164,98 +159,6 @@ def test_gui_shows_a_warning_and_disables_update_when_parameters_are_missing(
|
164 | 159 | assert gui.windowTitle().startswith("ERT - poly-no-gen-kw.ert")
|
165 | 160 |
|
166 | 161 |
|
167 |
| -def test_that_run_dialog_can_be_closed_while_file_plot_is_open( |
168 |
| - snake_oil_case_storage: ErtConfig, qtbot: QtBot |
169 |
| -): |
170 |
| - """ |
171 |
| - This is a regression test for a crash happening when |
172 |
| - closing the RunDialog with a file open. |
173 |
| - """ |
174 |
| - |
175 |
| - snake_oil_case = snake_oil_case_storage |
176 |
| - args_mock = Mock() |
177 |
| - args_mock.config = "snake_oil.ert" |
178 |
| - |
179 |
| - def handle_run_path_error_dialog(gui: ErtMainWindow, qtbot: QtBot): |
180 |
| - mb = gui.findChild(QMessageBox, "RUN_PATH_ERROR_BOX") |
181 |
| - |
182 |
| - if mb is not None: |
183 |
| - assert mb |
184 |
| - assert isinstance(mb, QMessageBox) |
185 |
| - # Continue without deleting the runpath |
186 |
| - qtbot.mouseClick(mb.buttons()[0], Qt.LeftButton) |
187 |
| - |
188 |
| - def handle_run_path_dialog( |
189 |
| - gui: ErtMainWindow, |
190 |
| - qtbot: QtBot, |
191 |
| - delete_run_path: bool = True, |
192 |
| - expect_error: bool = False, |
193 |
| - ): |
194 |
| - mb = gui.findChild(QMessageBox, "RUN_PATH_WARNING_BOX") |
195 |
| - |
196 |
| - if mb is not None: |
197 |
| - assert mb |
198 |
| - assert isinstance(mb, QMessageBox) |
199 |
| - |
200 |
| - if delete_run_path: |
201 |
| - qtbot.mouseClick(mb.checkBox(), Qt.LeftButton) |
202 |
| - |
203 |
| - qtbot.mouseClick(mb.buttons()[0], Qt.LeftButton) |
204 |
| - if expect_error: |
205 |
| - QTimer.singleShot( |
206 |
| - 1000, lambda: handle_run_path_error_dialog(gui, qtbot) |
207 |
| - ) |
208 |
| - |
209 |
| - with StorageService.init_service( |
210 |
| - project=os.path.abspath(snake_oil_case.ens_path), |
211 |
| - ), open_storage(snake_oil_case.ens_path, mode="w") as storage: |
212 |
| - gui = _setup_main_window(snake_oil_case, args_mock, GUILogHandler(), storage) |
213 |
| - experiment_panel = gui.findChild(ExperimentPanel) |
214 |
| - |
215 |
| - run_experiment = experiment_panel.findChild(QWidget, name="run_experiment") |
216 |
| - assert run_experiment |
217 |
| - assert isinstance(run_experiment, QToolButton) |
218 |
| - |
219 |
| - QTimer.singleShot( |
220 |
| - 1000, lambda: handle_run_path_dialog(gui, qtbot, delete_run_path=True) |
221 |
| - ) |
222 |
| - qtbot.mouseClick(run_experiment, Qt.LeftButton) |
223 |
| - |
224 |
| - run_dialog = wait_for_child(gui, qtbot, RunDialog) |
225 |
| - qtbot.waitUntil(run_dialog.done_button.isVisible, timeout=100000) |
226 |
| - fm_step_overview = run_dialog._fm_step_overview |
227 |
| - |
228 |
| - qtbot.waitUntil(fm_step_overview.isVisible, timeout=20000) |
229 |
| - qtbot.waitUntil(run_dialog.done_button.isVisible, timeout=200000) |
230 |
| - |
231 |
| - realization_widget = run_dialog.findChild(RealizationWidget) |
232 |
| - |
233 |
| - click_pos = realization_widget._real_view.rectForIndex( |
234 |
| - realization_widget._real_list_model.index(0, 0) |
235 |
| - ).center() |
236 |
| - |
237 |
| - with qtbot.waitSignal(realization_widget.itemClicked, timeout=30000): |
238 |
| - qtbot.mouseClick( |
239 |
| - realization_widget._real_view.viewport(), |
240 |
| - Qt.LeftButton, |
241 |
| - pos=click_pos, |
242 |
| - ) |
243 |
| - |
244 |
| - click_pos = fm_step_overview.visualRect( |
245 |
| - fm_step_overview.model().index(0, 4) |
246 |
| - ).center() |
247 |
| - qtbot.mouseClick(fm_step_overview.viewport(), Qt.LeftButton, pos=click_pos) |
248 |
| - |
249 |
| - qtbot.waitUntil(run_dialog.findChild(FileDialog).isVisible, timeout=30000) |
250 |
| - |
251 |
| - with qtbot.waitSignal(run_dialog.accepted, timeout=30000): |
252 |
| - run_dialog.close() # Close the run dialog by pressing 'x' close button |
253 |
| - |
254 |
| - # Ensure that once the run dialog is closed |
255 |
| - # another simulation can be started |
256 |
| - assert run_experiment.isEnabled() |
257 |
| - |
258 |
| - |
259 | 162 | @pytest.mark.usefixtures("set_site_config")
|
260 | 163 | def test_help_buttons_in_suggester_dialog(tmp_path, qtbot):
|
261 | 164 | """
|
|
0 commit comments