Skip to content

Commit 148f03f

Browse files
committed
Remove test that checks if rundialog can be closed
The Rundialog cannot be closed anymore
1 parent 2f306bb commit 148f03f

File tree

1 file changed

+0
-97
lines changed

1 file changed

+0
-97
lines changed

tests/ert/ui_tests/gui/test_main_window.py

-97
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88

99
import numpy as np
1010
import pytest
11-
from pytestqt.qtbot import QtBot
1211
from qtpy.QtCore import Qt, QTimer
1312
from qtpy.QtWidgets import (
1413
QAction,
1514
QCheckBox,
1615
QComboBox,
1716
QDoubleSpinBox,
1817
QMenuBar,
19-
QMessageBox,
2018
QPushButton,
2119
QToolButton,
2220
QTreeView,
@@ -34,11 +32,9 @@
3432
from ert.gui.main import ErtMainWindow, GUILogHandler, _setup_main_window
3533
from ert.gui.simulation.experiment_panel import ExperimentPanel
3634
from ert.gui.simulation.run_dialog import RunDialog
37-
from ert.gui.simulation.view import RealizationWidget
3835
from ert.gui.suggestor import Suggestor
3936
from ert.gui.suggestor._suggestor_message import SuggestorMessage
4037
from ert.gui.tools.event_viewer import add_gui_log_handler
41-
from ert.gui.tools.file.file_dialog import FileDialog
4238
from ert.gui.tools.manage_experiments import (
4339
ManageExperimentsPanel,
4440
)
@@ -57,7 +53,6 @@
5753
SingleTestRun,
5854
)
5955
from ert.services import StorageService
60-
from ert.storage import open_storage
6156

6257
from .conftest import (
6358
add_experiment_manually,
@@ -164,98 +159,6 @@ def test_gui_shows_a_warning_and_disables_update_when_parameters_are_missing(
164159
assert gui.windowTitle().startswith("ERT - poly-no-gen-kw.ert")
165160

166161

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-
259162
@pytest.mark.usefixtures("set_site_config")
260163
def test_help_buttons_in_suggester_dialog(tmp_path, qtbot):
261164
"""

0 commit comments

Comments
 (0)