diff --git a/tests/ert/ui_tests/cli/test_cli.py b/tests/ert/ui_tests/cli/test_cli.py index cb734eeb5cd..2413de8b085 100644 --- a/tests/ert/ui_tests/cli/test_cli.py +++ b/tests/ert/ui_tests/cli/test_cli.py @@ -555,16 +555,14 @@ def test_that_stop_on_fail_workflow_jobs_stop_ert( @pytest.mark.usefixtures("copy_poly_case") -def test_that_pre_post_experiment_hook_works( - monkeypatch, -): +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" > from_post_experiment.txt + echo "just sending regards" """) ) os.chmod("hello_post_exp.sh", 0o755) @@ -584,7 +582,7 @@ def test_that_pre_post_experiment_hook_works( with open("hello_pre_exp.sh", "w", encoding="utf-8") as f: f.write( dedent("""#!/bin/bash - echo "first" > from_pre_experiment.txt + echo "first" """) ) os.chmod("hello_pre_exp.sh", 0o755) @@ -617,14 +615,12 @@ def test_that_pre_post_experiment_hook_works( ) ) - run_cli(ITERATIVE_ENSEMBLE_SMOOTHER_MODE, "--disable-monitor", "poly.ert") + for mode in [ITERATIVE_ENSEMBLE_SMOOTHER_MODE, ES_MDA_MODE, ENSEMBLE_SMOOTHER_MODE]: + run_cli(mode, "--disable-monitor", "poly.ert") - assert (Path(os.getcwd()) / "from_pre_experiment.txt").read_text( - "utf-8" - ) == "first\n" - assert (Path(os.getcwd()) / "from_post_experiment.txt").read_text( - "utf-8" - ) == "just sending regards\n" + captured = capsys.readouterr() + assert "first" in captured.out + assert "just sending regards" in captured.out @pytest.fixture(name="mock_cli_run")