From face62b6414c4103b29855f8d8856846569c7b95 Mon Sep 17 00:00:00 2001 From: GPK Date: Sun, 6 Oct 2024 11:15:25 +0100 Subject: [PATCH] fix test_cli_internal_api_background process termination (#42773) --- tests/cli/commands/test_internal_api_command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/cli/commands/test_internal_api_command.py b/tests/cli/commands/test_internal_api_command.py index 2959cfa9f6f59..d821cc0246e44 100644 --- a/tests/cli/commands/test_internal_api_command.py +++ b/tests/cli/commands/test_internal_api_command.py @@ -141,9 +141,13 @@ def test_cli_internal_api_background(self, tmp_path): "[magenta]Terminating monitor process and expect " "internal-api and gunicorn processes to terminate as well" ) + internal_api_proc = psutil.Process(pid_internal_api) + internal_api_proc.terminate() proc = psutil.Process(pid_monitor) proc.terminate() - assert proc.wait(120) in (0, None) + gone, alive = psutil.wait_procs([internal_api_proc, proc], timeout=120) + for p in alive: + p.kill() self._check_processes(ignore_running=False) console.print("[magenta]All internal-api and gunicorn processes are terminated.") except Exception: