File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ def _execute_process(
47
47
)
48
48
49
49
_status_code = _result .wait ()
50
-
51
50
with open (f"{ runner_name } _{ proc_id } .err" ) as err :
52
51
std_err [proc_id ] = err .read ()
53
52
Original file line number Diff line number Diff line change 4
4
import sys
5
5
import tempfile
6
6
import pathlib
7
+ import os
7
8
import multiprocessing
8
9
9
10
@@ -38,6 +39,32 @@ def test_executor_add_process(
38
39
run .close ()
39
40
40
41
42
+ @pytest .mark .executor
43
+ def test_executor_multiprocess (request : pytest .FixtureRequest ) -> None :
44
+ with tempfile .TemporaryDirectory () as tempd :
45
+ with simvue .Run () as run :
46
+ run .init (
47
+ "test_executor_multiprocess" ,
48
+ folder = "/simvue_unit_testing" ,
49
+ tags = ["simvue_client_tests" , request .node .name ]
50
+ )
51
+
52
+ for i in range (10 ):
53
+ out_file = pathlib .Path (tempd ).joinpath (f"out_file_{ i } .dat" )
54
+ run .add_process (
55
+ f"cmd_{ i } " ,
56
+ executable = "bash" ,
57
+ c = "for i in {0..10}; do sleep 0.5; echo $i >> " + f"{ out_file } ; done"
58
+ )
59
+ time .sleep (1 )
60
+ for i in range (10 ):
61
+ out_file = pathlib .Path (tempd ).joinpath (f"out_file_{ i } .dat" )
62
+ assert out_file .exists ()
63
+ for i in range (10 ):
64
+ os .remove (f"test_executor_multiprocess_cmd_{ i } .err" )
65
+ os .remove (f"test_executor_multiprocess_cmd_{ i } .out" )
66
+
67
+
41
68
@pytest .mark .executor
42
69
def test_add_process_command_assembly (request : pytest .FixtureRequest ) -> None :
43
70
with tempfile .TemporaryDirectory () as tempd :
You can’t perform that action at this time.
0 commit comments