From 31518803ad83e7fc47e3bd24f3d766634ee19b21 Mon Sep 17 00:00:00 2001 From: Lev Vereshchagin Date: Sun, 1 May 2022 17:19:40 +0300 Subject: [PATCH] Cover all cases --- tests/conftest.py | 8 ++------ tests/utils.py | 6 +++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4651416c..e07227bf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,16 +43,12 @@ def compose(env_file: str): @pytest.fixture(autouse=True, scope="session") def frappe_setup(compose: Compose): - # Stop all containers in `test` project if they are running. - # We don't care if it fails. - with suppress(subprocess.CalledProcessError): - compose.stop() + compose.stop() compose("up", "-d", "--quiet-pull") yield - with suppress(subprocess.CalledProcessError): - compose.stop() + compose.stop() @pytest.fixture(scope="session") diff --git a/tests/utils.py b/tests/utils.py index ea830ed3..e4e96930 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,3 +1,4 @@ +from contextlib import suppress import os import ssl import subprocess @@ -46,7 +47,10 @@ class Compose: self("exec", "-T", *cmd) def stop(self) -> None: - subprocess.check_call(self.base_cmd + ("down", "-v", "--remove-orphans")) + # Stop all containers in `test` project if they are running. + # We don't care if it fails. + with suppress(subprocess.CalledProcessError): + subprocess.check_call(self.base_cmd + ("down", "-v", "--remove-orphans")) def bench(self, *cmd: str) -> None: self.exec("backend", "bench", *cmd)