Skip to content

Commit

Permalink
don't cleanup services if they aren't available
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Jun 19, 2018
1 parent f57ef5b commit 2527359
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
from unittest import mock

from docker import from_env as docker_from_env
from docker.errors import APIError
import pytest

from jupyterhub.tests.mocking import MockHub
@@ -40,7 +41,12 @@ def docker():
if c.name.startswith("dockerspawner-test"):
c.stop()
c.remove()

for c in d.services.list():
if c.name.startswith("dockerspawner-test"):
c.remove()
try:
services = d.services.list()
except APIError:
# e.g. services not available
return
else:
for s in services:
if s.name.startswith("dockerspawner-test"):
s.remove()

0 comments on commit 2527359

Please sign in to comment.