From a6271639adfa3d6ada9cff8f6fac3e5501ed0183 Mon Sep 17 00:00:00 2001 From: Niek <100143256+SchoNie@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:44:30 +0100 Subject: [PATCH] tests: DockerComposer contextmanager do not fail Change pytest.fail to a logging error because pytest.fail makes DockerComposer ContextManager exit and no _down teardown is executed. --- test/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index c420fa7..cc8265e 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -321,11 +321,11 @@ def __prepare_and_execute_compose_cmd(compose_files: List[str], project_name: st compose_cmd.write(f" --file {compose_file}") compose_cmd.write(f" {cmd}") - logging.info(compose_cmd.getvalue()) try: subprocess.check_output(shlex.split(compose_cmd.getvalue()), stderr=subprocess.STDOUT) + logging.info(f"Executed '{compose_cmd.getvalue()}'") except subprocess.CalledProcessError as e: - pytest.fail(f"Error while running '{compose_cmd.getvalue()}':\n{e.output}", pytrace=False) + logging.error(f"Error while running '{compose_cmd.getvalue()}'") def docker_compose_up(compose_files: List[str], project_name: str):