From 545e9cebb6bb8a5d7ab87be0079b140b3222ab83 Mon Sep 17 00:00:00 2001 From: Niek <100143256+SchoNie@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:46:37 +0100 Subject: [PATCH] tests: DockerComposer KeyboardInterrupt make sure we teardown on KeyboardInterrupt --- test/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/conftest.py b/test/conftest.py index cc8265e..e2eeed2 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -511,6 +511,11 @@ class DockerComposer(contextlib.AbstractContextManager): wait_for_nginxproxy_to_be_ready() time.sleep(3) # give time to containers to be ready + except KeyboardInterrupt: + logging.warning("KeyboardInterrupt detected! Force cleanup...") + self._down() # Ensure proper shutdown + raise # Re-raise to allow pytest to exit cleanly + except docker.errors.APIError as e: logging.error(f"Docker API error ({e.status_code}): {e.explanation}") logging.debug(f"Full error message: {str(e)}")