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)