Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Sep 30, 2024
1 parent 9a0fd2c commit d3fbff2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ert/config/design_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def from_config_list(cls, config_list: List[str]) -> "DesignMatrix":
}:
errors.append(
ErrorInfo(
f"DESIGN_MATRIX must be of format .xls or .xslx; is {filename}"
f"DESIGN_MATRIX must be of format .xls or .xlsx; is '{filename}'"
).set_context(config_list)
)
if design_sheet is None:
Expand Down
15 changes: 9 additions & 6 deletions tests/ert/unit_tests/config/test_analysis_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from ert.config.parsing import ConfigKeys, ConfigWarning


def test_analysis_config_from_file_is_same_as_from_dict():
def test_analysis_config_from_file_is_same_as_from_dict(monkeypatch, tmp_path):
with open(tmp_path / "my_design_matrix.xlsx", "w", encoding="utf-8"):
pass
monkeypatch.chdir(tmp_path)
assert ErtConfig.from_file_contents(
dedent(
"""
Expand All @@ -32,9 +35,9 @@ def test_analysis_config_from_file_is_same_as_from_dict():
("STD_ENKF", "ENKF_TRUNCATION", 0.8),
],
ConfigKeys.DESIGN_MATRIX: [
"my_design_matrix.xlsx"
"DESIGN_SHEET:my_sheet"
"DEFAULT_SHEET:my_default_sheet"
"my_design_matrix.xlsx",
"DESIGN_SHEET:my_sheet",
"DEFAULT_SHEET:my_default_sheet",
],
}
)
Expand Down Expand Up @@ -108,7 +111,7 @@ def test_design_matrix_without_design_sheet_raises_validation_error():
AnalysisConfig.from_dict(
{
ConfigKeys.DESIGN_MATRIX: [
"my_matrix.txt",
"my_matrix.xlsx",
"DESIGN_:design",
"DEFAULT_SHEET:default",
],
Expand All @@ -121,7 +124,7 @@ def test_design_matrix_without_default_sheet_raises_validation_error():
AnalysisConfig.from_dict(
{
ConfigKeys.DESIGN_MATRIX: [
"my_matrix.txt",
"my_matrix.xlsx",
"DESIGN_SHEET:design",
"DEFAULT_:default",
],
Expand Down

0 comments on commit d3fbff2

Please sign in to comment.