Skip to content

Commit

Permalink
Review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed May 23, 2024
1 parent 36dcb6f commit e903090
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run(

if ensemble_list is not None:
if ensemble_list.strip() == "*":
ensembles = self.getAllEnsembleList()
ensembles = self.getAllEnsembleList(storage)
else:
ensembles = ensemble_list.split(",")

Expand Down Expand Up @@ -168,21 +168,18 @@ def getArguments(self, parent, ert_config, storage):
description = "The CSV export requires some information before it starts:"
dialog = CustomDialog("CSV Export", description, parent)

default_csv_output_path = self.get_context_value(
"<CSV_OUTPUT_PATH>", default="output.csv"
)
subs_list = ert_config.substitution_list
default_csv_output_path = subs_list.get("<CSV_OUTPUT_PATH>", "output.csv")
output_path_model = PathModel(default_csv_output_path)
output_path_chooser = PathChooser(output_path_model)

design_matrix_default = self.get_context_value(
"<DESIGN_MATRIX_PATH>", default=""
)
design_matrix_default = subs_list.get("<DESIGN_MATRIX_PATH>", "")
design_matrix_path_model = PathModel(
design_matrix_default, is_required=False, must_exist=True
)
design_matrix_path_chooser = PathChooser(design_matrix_path_model)

list_edit = ListEditBox(self.getAllEnsembleList())
list_edit = ListEditBox(self.getAllEnsembleList(storage))

infer_iteration_check = QCheckBox()
infer_iteration_check.setChecked(True)
Expand Down Expand Up @@ -221,14 +218,9 @@ def getArguments(self, parent, ert_config, storage):

raise CancelPluginException("User cancelled!")

def get_context_value(self, name, default):
context = self.ert().substitution_list
if name in context:
return context[name]
return default

def getAllEnsembleList(self):
@staticmethod
def getAllEnsembleList(storage):
all_ensemble_list = [
ensemble.name for ensemble in self.storage.ensembles if ensemble.has_data()
ensemble.name for ensemble in storage.ensembles if ensemble.has_data()
]
return all_ensemble_list
3 changes: 1 addition & 2 deletions tests/unit_tests/gui/simulation/test_run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,14 @@ def test_that_exception_in_base_run_model_is_handled(qtbot: QtBot, storage):
args_mock.config = config_file

ert_config = ErtConfig.from_file(config_file)
enkf_main = EnKFMain(ert_config)
with StorageService.init_service(
project=os.path.abspath(ert_config.ens_path),
), patch.object(
ert.run_models.SingleTestRun,
"run_experiment",
MagicMock(side_effect=ValueError("I failed :(")),
):
gui = _setup_main_window(enkf_main, args_mock, GUILogHandler(), storage)
gui = _setup_main_window(ert_config, args_mock, GUILogHandler(), storage)
qtbot.addWidget(gui)
start_simulation = gui.findChild(QToolButton, name="start_simulation")

Expand Down

0 comments on commit e903090

Please sign in to comment.