Skip to content

Commit

Permalink
Fix builds failing (#793)
Browse files Browse the repository at this point in the history
* Fix builds failing
Fixes #792

* Suppress `docker compose down` errors in cleanup

* Cover all cases

* Fix linting

* Remove unused import
  • Loading branch information
vrslev authored May 1, 2022
1 parent ed53114 commit 9f502c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def compose(env_file: str):
@pytest.fixture(autouse=True, scope="session")
def frappe_setup(compose: Compose):
compose.stop()

compose("up", "-d", "--quiet-pull")
yield

compose.stop()


Expand Down
6 changes: 5 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess
import sys
import time
from contextlib import suppress
from typing import Callable, Optional
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
Expand Down Expand Up @@ -46,7 +47,10 @@ def exec(self, *cmd: str) -> None:
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)
Expand Down

0 comments on commit 9f502c8

Please sign in to comment.