Skip to content

Commit

Permalink
remove wrapt.decorator from test utils
Browse files Browse the repository at this point in the history
It breaks windows tests for 3.13
  • Loading branch information
RLKRo committed Oct 28, 2024
1 parent 6b5dbf3 commit 177963b
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
from typing import Callable, Optional

from python_on_whales import DockerClient
from wrapt import decorator


@decorator
def docker_client(wrapped: Callable[[Optional[DockerClient]], int], _, __, ___) -> int:
if "linux" in sys.platform:
docker = DockerClient(
compose_files=["compose.yml"],
compose_profiles=["context_storage", "stats"],
)
docker.compose.up(detach=True, wait=True, quiet=True)
error = None
try:
result = wrapped(docker)
except Exception as e:
result = 1
error = e
finally:
docker.compose.down(remove_orphans=False, quiet=True)
if error is not None:
raise error
else:
result = wrapped(None)
return result
def docker_client(wrapped: Callable[[Optional[DockerClient]], int]):
def wrapper() -> int:
if "linux" in sys.platform:
docker = DockerClient(
compose_files=["compose.yml"],
compose_profiles=["context_storage", "stats"],
)
docker.compose.up(detach=True, wait=True, quiet=True)
error = None
try:
result = wrapped(docker)
except Exception as e:
result = 1
error = e
finally:
docker.compose.down(remove_orphans=False, quiet=True)
if error is not None:
raise error
else:
result = wrapped(None)
return result
return wrapper

0 comments on commit 177963b

Please sign in to comment.