Skip to content

Commit

Permalink
Already covered by test_hook_order
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Jan 20, 2025
1 parent 1528d2e commit 660d487
Showing 1 changed file with 0 additions and 69 deletions.
69 changes: 0 additions & 69 deletions tests/ert/ui_tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,75 +520,6 @@ def test_that_stop_on_fail_workflow_jobs_stop_ert(
run_cli(TEST_RUN_MODE, "--disable-monitoring", "poly.ert")


@pytest.mark.usefixtures("copy_poly_case")
def test_that_pre_post_experiment_hook_works(monkeypatch, capsys):
monkeypatch.setattr(_ert.threading, "_can_raise", False)

# The executable
with open("hello_post_exp.sh", "w", encoding="utf-8") as f:
f.write(
dedent("""#!/bin/bash
echo "just sending regards"
""")
)
os.chmod("hello_post_exp.sh", 0o755)

# The workflow job
with open("SAY_HELLO_POST_EXP", "w", encoding="utf-8") as s:
s.write("""
INTERNAL False
EXECUTABLE hello_post_exp.sh
""")

# The workflow
with open("SAY_HELLO_POST_EXP.wf", "w", encoding="utf-8") as s:
s.write("""dump_final_ensemble_id""")

# The executable
with open("hello_pre_exp.sh", "w", encoding="utf-8") as f:
f.write(
dedent("""#!/bin/bash
echo "first"
""")
)
os.chmod("hello_pre_exp.sh", 0o755)

# The workflow job
with open("SAY_HELLO_PRE_EXP", "w", encoding="utf-8") as s:
s.write("""
INTERNAL False
EXECUTABLE hello_pre_exp.sh
""")

# The workflow
with open("SAY_HELLO_PRE_EXP.wf", "w", encoding="utf-8") as s:
s.write("""dump_first_ensemble_id""")

with open("poly.ert", mode="a", encoding="utf-8") as fh:
fh.write(
dedent(
"""
NUM_REALIZATIONS 2
LOAD_WORKFLOW_JOB SAY_HELLO_POST_EXP dump_final_ensemble_id
LOAD_WORKFLOW SAY_HELLO_POST_EXP.wf POST_EXPERIMENT_DUMP
HOOK_WORKFLOW POST_EXPERIMENT_DUMP POST_EXPERIMENT
LOAD_WORKFLOW_JOB SAY_HELLO_PRE_EXP dump_first_ensemble_id
LOAD_WORKFLOW SAY_HELLO_PRE_EXP.wf PRE_EXPERIMENT_DUMP
HOOK_WORKFLOW PRE_EXPERIMENT_DUMP PRE_EXPERIMENT
"""
)
)

for mode in [ITERATIVE_ENSEMBLE_SMOOTHER_MODE, ES_MDA_MODE, ENSEMBLE_SMOOTHER_MODE]:
run_cli(mode, "--disable-monitoring", "poly.ert")

captured = capsys.readouterr()
assert "first" in captured.out
assert "just sending regards" in captured.out


@pytest.fixture(name="mock_cli_run")
def fixture_mock_cli_run(monkeypatch):
end_event = Mock()
Expand Down

0 comments on commit 660d487

Please sign in to comment.