Skip to content

Commit

Permalink
Fix a regression of using REFCASE with extension
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Feb 9, 2024
1 parent 5072a4e commit 791fe11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/ert/config/_read_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ def _find_file_matching(


def _get_summary_filenames(filepath: str) -> Tuple[str, str]:
if filepath.lower().endswith(".data"):
# For backwards compatability, it is
# allowed to give REFCASE and ECLBASE both
# with and without .DATA extensions
filepath = filepath[:-5]
summary = _find_file_matching("unified summary file", filepath, _is_unsmry)
spec = _find_file_matching("smspec file", filepath, _is_smspec)
return summary, spec
Expand Down
7 changes: 4 additions & 3 deletions tests/unit_tests/config/test_observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,21 +682,22 @@ def test_that_out_of_bounds_segments_are_truncated(tmpdir, start, stop, message)
ErtConfig.from_file("config.ert")


@pytest.mark.parametrize("with_ext", [True, False])
@pytest.mark.parametrize(
"keys",
[
[("FOPR", "SM3/DAY", None), ("FOPRH", "SM3/DAY", None)],
[("WWIR", "SM3/DAY", "WNAME"), ("WWIRH", "SM3/DAY", "WNAME")],
],
)
def test_that_history_observations_are_loaded(tmpdir, keys):
def test_that_history_observations_are_loaded(tmpdir, keys, with_ext):
with tmpdir.as_cwd():
config = dedent(
"""
f"""
NUM_REALIZATIONS 2
ECLBASE ECLIPSE_CASE
REFCASE ECLIPSE_CASE
REFCASE ECLIPSE_CASE{".DATA" if with_ext else ""}
OBS_CONFIG observations
"""
)
Expand Down

0 comments on commit 791fe11

Please sign in to comment.