Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Dec 6, 2024
1 parent e6aff6b commit c5c47d5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ert/gui/simulation/multiple_data_assimilation_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __init__(
self._active_realizations_model, # type: ignore
"config/simulation/active_realizations",
)
self._active_realizations_field.setObjectName("active_realizations_box")
self._active_realizations_field.setValidator(RangeStringArgument(ensemble_size))
self._ensemble_selector = EnsembleSelector(notifier)
layout.addRow("Active realizations:", self._active_realizations_field)
Expand Down
40 changes: 39 additions & 1 deletion tests/ert/ui_tests/gui/test_restart_esmda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ert.gui.ertwidgets import StringBox
from ert.gui.simulation.experiment_panel import ExperimentPanel
from ert.gui.simulation.run_dialog import RunDialog
from ert.run_models import MultipleDataAssimilation
from ert.run_models import MultipleDataAssimilation, SingleTestRun

from .conftest import get_child

Expand Down Expand Up @@ -40,6 +40,44 @@ def test_restart_esmda(ensemble_experiment_has_run_no_failure, qtbot):
)


def test_active_realizations_esmda(opened_main_window_poly, qtbot):
"""This runs an es-mda run from an ensemble created from an ensemble_experiment
run, via the restart feature for es-mda.
Regression test for several issues where this failed only in the gui.
"""
gui = opened_main_window_poly

experiment_panel = get_child(gui, ExperimentPanel)
simulation_mode_combo = get_child(experiment_panel, QComboBox)
simulation_mode_combo.setCurrentText(SingleTestRun.name())

single_test_run_panel = gui.findChild(QWidget, name="Single_test_run_panel")
assert single_test_run_panel
run_experiment = experiment_panel.findChild(QWidget, name="run_experiment")
qtbot.mouseClick(run_experiment, Qt.MouseButton.LeftButton)
qtbot.waitUntil(lambda: gui.findChild(RunDialog) is not None)
run_dialog = gui.findChild(RunDialog)
qtbot.waitUntil(lambda: run_dialog.is_simulation_done() == True, timeout=60000)
assert (
run_dialog._total_progress_label.text()
== "Total progress 100% — Experiment completed."
)

simulation_mode_combo.setCurrentText(MultipleDataAssimilation.name())
es_mda_panel = gui.findChild(QWidget, name="ES_MDA_panel")
assert es_mda_panel
active_reals = gui.findChild(StringBox, "active_realizations_box")
assert active_reals.text() == "0-19"

restart_checkbox = es_mda_panel.findChild(QCheckBox, name="restart_checkbox_esmda")
assert restart_checkbox
assert not restart_checkbox.isChecked()
restart_checkbox.click()
assert active_reals.text() == "0"
restart_checkbox.click()
assert active_reals.text() == "0-19"


def test_custom_weights_stored_and_retrieved_from_metadata_esmda(
opened_main_window_minimal_realizations, qtbot
):
Expand Down

0 comments on commit c5c47d5

Please sign in to comment.