diff --git a/src/ert/resources/forward_models/run_reservoirsimulator.py b/src/ert/resources/forward_models/run_reservoirsimulator.py index a6247dcf8ab..983749342ee 100755 --- a/src/ert/resources/forward_models/run_reservoirsimulator.py +++ b/src/ert/resources/forward_models/run_reservoirsimulator.py @@ -155,7 +155,7 @@ def __init__( self.summary_conversion: bool = summary_conversion self.bypass_flowrun: bool = False - self.forwarded_args: list[str] = forwarded_args or [] + self.forwarded_args: list[str] = " ".join(forwarded_args or []).split() runner_abspath: str | Path | None = None if simulator in {"eclipse", "e300"}: diff --git a/tests/ert/unit_tests/resources/test_run_reservoirsimulator.py b/tests/ert/unit_tests/resources/test_run_reservoirsimulator.py index 2f7d054e698..ab26c7b83b3 100644 --- a/tests/ert/unit_tests/resources/test_run_reservoirsimulator.py +++ b/tests/ert/unit_tests/resources/test_run_reservoirsimulator.py @@ -161,7 +161,7 @@ def slow_smry_writer(): @pytest.mark.parametrize("simulator", ["eclipse", "e300", "flow"]) @pytest.mark.usefixtures("use_tmpdir") -def test_runner_will_forward_unknown_arguments_to_eclrun(monkeypatch, simulator): +def test_runner_will_forward_unknown_arguments(monkeypatch, simulator): eclrun_bin = Path("bin/eclrun") eclrun_bin.parent.mkdir() eclrun_bin.write_text("#!/bin/sh\necho $@ > eclrun_args\nexit 0", encoding="utf-8") @@ -184,3 +184,33 @@ def test_runner_will_forward_unknown_arguments_to_eclrun(monkeypatch, simulator) assert "--arbitrary_option_being_forwarded" in Path("eclrun_args").read_text( encoding="utf-8" ) + + +@pytest.mark.parametrize("simulator", ["eclipse", "e300", "flow"]) +@pytest.mark.usefixtures("use_tmpdir") +def test_runner_will_forward_multiple_unknown_arguments(monkeypatch, simulator): + eclrun_bin = Path("bin/eclrun") + eclrun_bin.parent.mkdir() + eclrun_bin.write_text( + '#!/bin/sh\nfor arg in "$@"; do echo $arg >> eclrun_args; done\nexit 0', + encoding="utf-8", + ) + eclrun_bin.chmod(eclrun_bin.stat().st_mode | stat.S_IEXEC) + shutil.copy(eclrun_bin, "bin/flowrun") + monkeypatch.setenv("PATH", f"bin:{os.environ['PATH']}") + Path("EIGHTCELLS.DATA").touch() + Path("EIGHTCELLS.PRT").write_text("Errors 0\nBugs 0", encoding="utf-8") + + run_reservoirsimulator.run_reservoirsimulator( + [ + simulator, + "EIGHTCELLS.DATA", + "--version", + "2019.3", + "--first-option --second-option", + ] + ) + + assert "--first-option\n--second-option" in Path("eclrun_args").read_text( + encoding="utf-8" + )