Skip to content

Commit 7b9aed5

Browse files
committed
🧪 Switch to BASH based process test
1 parent f139788 commit 7b9aed5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

‎tests/functional/test_run_execute_process.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,29 @@ def test_monitor_processes(create_plain_run_offline: tuple[Run, dict]):
2424
@pytest.mark.executor
2525
def test_abort_all_processes(create_plain_run: tuple[Run, dict]) -> None:
2626
_run, _ = create_plain_run
27-
with tempfile.NamedTemporaryFile(suffix=".py") as temp_f:
27+
with tempfile.NamedTemporaryFile(suffix=".sh") as temp_f:
2828
with open(temp_f.name, "w") as out_f:
2929
out_f.writelines([
30-
"import time\n",
31-
"count = 0\n"
32-
"while True:\n",
33-
" print(count)\n"
34-
" time.sleep(1)\n"
35-
" count += 1"
30+
"for i in {0..20}; do\n",
31+
" echo $i\n",
32+
" sleep 1\n",
33+
"done\n"
3634
])
3735

3836
for i in range(1, 3):
39-
_run.add_process(f"process_{i}", executable="python", script=temp_f.name)
40-
assert _run.executor.get_command(f"process_{i}") == f"python {temp_f.name}"
37+
_run.add_process(f"process_{i}", executable="bash", script=temp_f.name)
38+
assert _run.executor.get_command(f"process_{i}") == f"bash {temp_f.name}"
4139

4240

43-
time.sleep(1)
41+
time.sleep(3)
4442

4543
_run.kill_all_processes()
4644

4745
# Check that for when one of the processes has stopped
4846
_attempts: int = 0
4947
_first_out = next(pathlib.Path.cwd().glob("*process_*.out"))
5048

51-
while _first_out.stat().st_size == 0 and attempts < 10:
49+
while _first_out.stat().st_size == 0 and _attempts < 10:
5250
time.sleep(1)
5351
_attempts += 1
5452

0 commit comments

Comments
 (0)