Skip to content

Commit 541d7db

Browse files
committed
Add LibresFacade testing valid runpaths
1 parent bdf821d commit 541d7db

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/unit_tests/gui/tools/test_case_tool.py

+17
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
from qtpy.QtCore import Qt
66
from qtpy.QtWidgets import QPushButton
77

8+
from ert import LibresFacade
89
from ert._c_wrappers.enkf import EnKFMain, ResConfig
910
from ert._clib.state_map import RealizationStateEnum
1011
from ert._clib.update import Parameter
12+
from ert.gui.tools.load_results import LoadResultsTool
1113
from ert.gui.tools.manage_cases.case_init_configuration import (
1214
CaseInitializationConfigurationPanel,
1315
)
@@ -70,3 +72,18 @@ def test_that_case_tool_can_copy_case_state(qtbot):
7072
assert new_case.load_parameter(config_node, [0], parameter,).flatten()[
7173
0
7274
] == pytest.approx(-0.8814227775506998)
75+
76+
77+
@pytest.mark.parametrize(
78+
"run_path, expected",
79+
[
80+
("valid_%d", True),
81+
("valid_%d/iter_%d", True),
82+
("invalid", False),
83+
],
84+
)
85+
def test_results_tool_valid_runpath(run_path, expected, tmp_path):
86+
config_file = tmp_path / "config.ert"
87+
config_file.write_text(f"NUM_REALIZATIONS 1\nRUNPATH {run_path}\n")
88+
tool = LoadResultsTool(LibresFacade.from_config_file(str(config_file)))
89+
assert tool.is_valid_run_path() is expected

0 commit comments

Comments
 (0)