Skip to content

Commit

Permalink
Fixups - I
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Oct 11, 2024
1 parent a77b557 commit 90e5e34
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/ert/unit_tests/gui/simulation/test_run_dialog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path
from queue import SimpleQueue
from unittest.mock import MagicMock, Mock, patch

Expand All @@ -17,7 +18,7 @@
)

import ert
from ert.config import ErtConfig
from ert.config import DesignMatrix, ErtConfig
from ert.ensemble_evaluator import state
from ert.ensemble_evaluator.event import (
EndEvent,
Expand Down Expand Up @@ -720,14 +721,15 @@ def test_that_stdout_and_stderr_buttons_react_to_file_content(
def test_that_design_matrix_show_parameters_button(
design_matrix_entry, qtbot: QtBot, storage
):
with open("design_matrix.xlsx", "w", encoding="utf-8"):
xls_filename = "design_matrix.xls"
with open(f"{xls_filename}", "w", encoding="utf-8"):
pass
config_file = "minimal_config.ert"
with open(config_file, "w", encoding="utf-8") as f:
f.write("NUM_REALIZATIONS 1")
if design_matrix_entry:
f.write(
"\nDESIGN_MATRIX design_matrix.xlsx DESIGN_SHEET:DesignSheet01 DEFAULT_SHEET:DefaultValues"
f"\nDESIGN_MATRIX {xls_filename} DESIGN_SHEET:DesignSheet01 DEFAULT_SHEET:DefaultValues"
)

args_mock = Mock()
Expand All @@ -754,8 +756,7 @@ def test_that_design_matrix_show_parameters_button(
assert show_dm_parameters.isEnabled() == design_matrix_entry
if show_dm_parameters.isEnabled():
design_matrix_df = pd.DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
filename = "design_matrix.xlsl"
with patch.object(
ert.config.DesignMatrix, "design_matrix_df", design_matrix_df
), patch.object(ert.config.DesignMatrix, "xlsl_filename", filename):
DesignMatrix, "design_matrix_df", design_matrix_df
), patch.object(DesignMatrix, "xls_filename", Path(xls_filename)):
qtbot.mouseClick(show_dm_parameters, Qt.LeftButton)

0 comments on commit 90e5e34

Please sign in to comment.