From 229caa09c9a2e162ea934389327d71c63a99af42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 04:29:41 +0000 Subject: [PATCH] Check return code and log stderr on cleanup failure Co-authored-by: bandrel <3598052+bandrel@users.noreply.github.com> --- tests/test_docker_script_install.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_docker_script_install.py b/tests/test_docker_script_install.py index 0d8132b..69d73a2 100644 --- a/tests/test_docker_script_install.py +++ b/tests/test_docker_script_install.py @@ -41,15 +41,21 @@ def docker_image(): # Cleanup: remove the Docker image after tests complete try: - subprocess.run( + result = subprocess.run( ["docker", "image", "rm", image_tag], capture_output=True, text=True, timeout=60, ) + if result.returncode != 0: + print( + f"Warning: Failed to remove Docker image {image_tag}. " + f"stderr={result.stderr}", + file=sys.stderr + ) except Exception as e: # Don't fail the test if cleanup fails, but log the issue - print(f"Warning: Failed to remove Docker image {image_tag}: {e}", file=sys.stderr) + print(f"Warning: Exception while removing Docker image {image_tag}: {e}", file=sys.stderr) def _run_container(image_tag, command, timeout=180):