Skip to content

Commit f139788

Browse files
committed
🧪 Use non-zero file size as test completion
In the abort processes test use the point at which stdout file is non-zero to mark test completion.
1 parent 256578d commit f139788

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎tests/functional/test_run_execute_process.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,22 @@ def test_abort_all_processes(create_plain_run: tuple[Run, dict]) -> None:
3939
_run.add_process(f"process_{i}", executable="python", script=temp_f.name)
4040
assert _run.executor.get_command(f"process_{i}") == f"python {temp_f.name}"
4141

42-
time.sleep(3)
42+
43+
time.sleep(1)
4344

4445
_run.kill_all_processes()
4546

47+
# Check that for when one of the processes has stopped
48+
_attempts: int = 0
49+
_first_out = next(pathlib.Path.cwd().glob("*process_*.out"))
50+
51+
while _first_out.stat().st_size == 0 and attempts < 10:
52+
time.sleep(1)
53+
_attempts += 1
54+
55+
if _attempts >= 10:
56+
raise AssertionError("Failed to terminate processes")
57+
4658
# Check the Python process did not error
4759
_out_err = pathlib.Path.cwd().glob("*process_*.err")
4860
for file in _out_err:

0 commit comments

Comments
 (0)