-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable modes that do parameter updates if there are no params to update
If all parameters have UPDATE:FALSE set, then we should not let the user select any mode that does parameter updates.
- Loading branch information
Showing
4 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import fileinput | ||
from argparse import ArgumentParser | ||
|
||
import pytest | ||
|
||
from ert.__main__ import ert_parser | ||
from ert.cli.main import ErtCliError, run_cli | ||
from ert.mode_definitions import ENSEMBLE_SMOOTHER_MODE | ||
|
||
|
||
@pytest.mark.usefixtures("copy_poly_case") | ||
def test_running_smoother_raises_without_updateable_parameters(): | ||
with fileinput.input("poly.ert", inplace=True) as fin: | ||
for line in fin: | ||
if "GEN_KW COEFFS coeff_priors" in line: | ||
print(f"{line[:-1]} UPDATE:FALSE") | ||
else: | ||
print(line, end="") | ||
|
||
parser = ArgumentParser(prog="test_main") | ||
parsed = ert_parser( | ||
parser, | ||
[ | ||
ENSEMBLE_SMOOTHER_MODE, | ||
"--disable-monitor", | ||
"poly.ert", | ||
], | ||
) | ||
|
||
with pytest.raises(ErtCliError) as e: | ||
run_cli(parsed) | ||
assert "All parameters are set to UPDATE:FALSE in" in str(e) |
38 changes: 38 additions & 0 deletions
38
tests/ert/ui_tests/gui/test_missing_parameters_to_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import fileinput | ||
|
||
import pytest | ||
from qtpy.QtCore import Qt | ||
from qtpy.QtWidgets import QComboBox | ||
|
||
from ert.gui.simulation.experiment_panel import ExperimentPanel | ||
from tests.ert.ui_tests.gui.conftest import get_child, open_gui_with_config | ||
|
||
|
||
@pytest.mark.usefixtures("copy_poly_case") | ||
def test_no_updateable_parameters(qtbot): | ||
with fileinput.input("poly.ert", inplace=True) as fin: | ||
for line in fin: | ||
if "GEN_KW COEFFS coeff_priors" in line: | ||
print(f"{line[:-1]} UPDATE:FALSE") | ||
else: | ||
print(line, end="") | ||
|
||
for gui in open_gui_with_config("poly.ert"): | ||
experiment_panel = get_child(gui, ExperimentPanel) | ||
simulation_mode_combo = get_child(experiment_panel, QComboBox) | ||
idx = simulation_mode_combo.findText("Ensemble smoother") | ||
assert not ( | ||
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled | ||
) | ||
idx = simulation_mode_combo.findText("Multiple data assimilation") | ||
assert not ( | ||
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled | ||
) | ||
idx = simulation_mode_combo.findText("Iterated ensemble smoother") | ||
assert not ( | ||
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled | ||
) | ||
idx = simulation_mode_combo.findText("Ensemble experiment") | ||
assert ( | ||
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled | ||
) |