diff --git a/tagging/utils/docker_runner.py b/tagging/utils/docker_runner.py index c2020109..adc9418d 100644 --- a/tagging/utils/docker_runner.py +++ b/tagging/utils/docker_runner.py @@ -39,9 +39,8 @@ class DockerRunner: ) -> None: assert self.container is not None LOGGER.info(f"Removing container {self.container.name} ...") - if self.container: - self.container.remove(force=True) - LOGGER.info(f"Container {self.container.name} removed") + self.container.remove(force=True) + LOGGER.info(f"Container {self.container.name} removed") @staticmethod def run_simple_command( diff --git a/tests/utils/tracked_container.py b/tests/utils/tracked_container.py index 6942b4be..51a86afc 100644 --- a/tests/utils/tracked_container.py +++ b/tests/utils/tracked_container.py @@ -92,5 +92,9 @@ class TrackedContainer: def remove(self) -> None: """Kills and removes the tracked docker container.""" - if self.container: + if self.container is None: + LOGGER.info("No container to remove") + else: + LOGGER.info(f"Removing container {self.container.name} ...") self.container.remove(force=True) + LOGGER.info(f"Container {self.container.name} removed")