diff --git a/simvue/executor.py b/simvue/executor.py index 1bad7de6..f4710137 100644 --- a/simvue/executor.py +++ b/simvue/executor.py @@ -47,7 +47,6 @@ def _execute_process( ) _status_code = _result.wait() - with open(f"{runner_name}_{proc_id}.err") as err: std_err[proc_id] = err.read() diff --git a/tests/refactor/test_executor.py b/tests/refactor/test_executor.py index 5cc6626a..af3f3dca 100644 --- a/tests/refactor/test_executor.py +++ b/tests/refactor/test_executor.py @@ -4,6 +4,7 @@ import sys import tempfile import pathlib +import os import multiprocessing @@ -38,6 +39,32 @@ def test_executor_add_process( run.close() +@pytest.mark.executor +def test_executor_multiprocess(request: pytest.FixtureRequest) -> None: + with tempfile.TemporaryDirectory() as tempd: + with simvue.Run() as run: + run.init( + "test_executor_multiprocess", + folder="/simvue_unit_testing", + tags=["simvue_client_tests", request.node.name] + ) + + for i in range(10): + out_file = pathlib.Path(tempd).joinpath(f"out_file_{i}.dat") + run.add_process( + f"cmd_{i}", + executable="bash", + c="for i in {0..10}; do sleep 0.5; echo $i >> "+ f"{out_file}; done" + ) + time.sleep(1) + for i in range(10): + out_file = pathlib.Path(tempd).joinpath(f"out_file_{i}.dat") + assert out_file.exists() + for i in range(10): + os.remove(f"test_executor_multiprocess_cmd_{i}.err") + os.remove(f"test_executor_multiprocess_cmd_{i}.out") + + @pytest.mark.executor def test_add_process_command_assembly(request: pytest.FixtureRequest) -> None: with tempfile.TemporaryDirectory() as tempd: