Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Dec 6, 2024
1 parent 0fc30a9 commit 5af64f6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,4 +669,4 @@ def _available_eclrun_versions(
.split(" ")
)
except subprocess.CalledProcessError:
return
return []
6 changes: 3 additions & 3 deletions test-data/ert/poly_example/poly.ert
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
QUEUE_SYSTEM LOCAL
QUEUE_OPTION LOCAL MAX_RUNNING 50
QUEUE_SYSTEM LSF
QUEUE_OPTION LSF SUBMIT_SLEEP 0

RUNPATH poly_out/realization-<IENS>/iter-<ITER>

OBS_CONFIG observations
REALIZATION_MEMORY 50mb

NUM_REALIZATIONS 100
NUM_REALIZATIONS 1000
MIN_REALIZATIONS 1

GEN_KW COEFFS coeff_priors
Expand Down
2 changes: 2 additions & 0 deletions test-data/ert/poly_example/poly_eval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import json
import time


def _load_coeffs(filename):
Expand All @@ -16,3 +17,4 @@ def _evaluate(coeffs, x):
output = [_evaluate(coeffs, x) for x in range(10)]
with open("poly.out", "w", encoding="utf-8") as f:
f.write("\n".join(map(str, output)))
time.sleep(10)
33 changes: 17 additions & 16 deletions tests/ert/unit_tests/config/test_forward_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,12 @@ def test_that_eclipse_jobs_check_version(eclipse_v, mock_eclrun):

ecl100_config_content = f"eclrun_env:\n PATH: {os.getcwd()}\n"
ecl300_config_content = f"eclrun_env:\n PATH: {os.getcwd()}\n"
ert_config_contents = (
f"NUM_REALIZATIONS 1\nFORWARD_MODEL ECLIPSE{eclipse_v} (<VERSION>=1)\n"
)
ert_config_contents = f"""NUM_REALIZATIONS 1
SETENV ECL100_SITE_CONFIG {ecl100_config_file_name}
SETENV ECL300_SITE_CONFIG {ecl300_config_file_name}
FORWARD_MODEL ECLIPSE{eclipse_v} (<VERSION>=1)"""

# Write config file
config_file_name = "test.ert"
Expand All @@ -607,17 +610,11 @@ def test_that_eclipse_jobs_check_version(eclipse_v, mock_eclrun):
Path(ecl100_config_file_name).write_text(ecl100_config_content, encoding="utf-8")
# Write ecl300_config file
Path(ecl300_config_file_name).write_text(ecl300_config_content, encoding="utf-8")
with patch(
"ert.plugins.hook_implementations.forward_model_steps.ErtPluginManager"
) as mock:
instance = mock.return_value
instance.get_ecl100_config_path.return_value = ecl100_config_file_name
instance.get_ecl300_config_path.return_value = ecl300_config_file_name
with pytest.raises(
ConfigValidationError,
match=rf".*Unavailable ECLIPSE{eclipse_v} version 1 current supported versions \['4', '2', '8'\].*",
):
_ = ErtConfig.with_plugins().from_file(config_file_name)
with pytest.raises(
ConfigValidationError,
match=rf".*Unavailable ECLIPSE{eclipse_v} version 1 current supported versions \['4', '2', '8'\].*",
):
ErtConfig.with_plugins().from_file(config_file_name)


@pytest.mark.skipif(shutil.which("eclrun") is not None, reason="eclrun is available")
Expand Down Expand Up @@ -1045,7 +1042,9 @@ class FMWithAssertionError(ForwardModelStepPlugin):
def __init__(self):
super().__init__(name="FMWithAssertionError", command=["the_executable.sh"])

def validate_pre_experiment(self, fm_step_json: ForwardModelStepJSON) -> None:
def validate_pre_experiment(
self, fm_step_json: ForwardModelStepJSON, _: dict
) -> None:
raise AssertionError("I should be a warning")

class FMWithFMStepValidationError(ForwardModelStepPlugin):
Expand All @@ -1055,7 +1054,9 @@ def __init__(self):
command=["the_executable.sh"],
)

def validate_pre_experiment(self, fm_step_json: ForwardModelStepJSON) -> None:
def validate_pre_experiment(
self, fm_step_json: ForwardModelStepJSON, _: dict
) -> None:
raise ForwardModelStepValidationError("I should not be a warning")

with (
Expand Down

0 comments on commit 5af64f6

Please sign in to comment.