Skip to content

Commit faf48cc

Browse files
Mark Andreevtillahoffmann
authored andcommitted
Add stop_silent for stop containers after exit (#104)
1 parent 1774c55 commit faf48cc

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

testcontainers/core/cleaner.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77

88
def stop_silent(container):
9-
def wrapper():
10-
try:
11-
container.stop()
12-
except NotFound:
13-
pass
14-
except Exception as e:
15-
logger.exception(e)
16-
return wrapper
9+
try:
10+
container.stop()
11+
except NotFound:
12+
pass
13+
except Exception as e:
14+
logger.exception(e)

testcontainers/core/docker_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def run(self, image: str,
4242
environment=environment,
4343
ports=ports,
4444
**kwargs)
45-
atexit.register(stop_silent(container))
45+
atexit.register(stop_silent, container)
4646

4747
return container
4848

0 commit comments

Comments
 (0)