Kaydet (Commit) e15b3bb6 authored tarafından Michael Merickel's avatar Michael Merickel

allow docker client to connect to a remote host

to run the tests on a host without using the default unix socket, it's
now possible to specify:

    DOCKER_HOST=tcp://localdocker:4243 env/bin/python setup.py test
üst 272c1f86
...@@ -28,6 +28,8 @@ import six ...@@ -28,6 +28,8 @@ import six
# FIXME: missing tests for # FIXME: missing tests for
# export; history; import_image; insert; port; push; tag; get; load # export; history; import_image; insert; port; push; tag; get; load
DEFAULT_BASE_URL = os.environ.get('DOCKER_HOST')
class BaseTestCase(unittest.TestCase): class BaseTestCase(unittest.TestCase):
tmp_imgs = [] tmp_imgs = []
...@@ -35,7 +37,7 @@ class BaseTestCase(unittest.TestCase): ...@@ -35,7 +37,7 @@ class BaseTestCase(unittest.TestCase):
tmp_folders = [] tmp_folders = []
def setUp(self): def setUp(self):
self.client = docker.Client(timeout=5) self.client = docker.Client(base_url=DEFAULT_BASE_URL, timeout=5)
self.tmp_imgs = [] self.tmp_imgs = []
self.tmp_containers = [] self.tmp_containers = []
self.tmp_folders = [] self.tmp_folders = []
...@@ -910,6 +912,6 @@ class TestConnectionTimeout(unittest.TestCase): ...@@ -910,6 +912,6 @@ class TestConnectionTimeout(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
c = docker.Client() c = docker.Client(base_url=DEFAULT_BASE_URL)
c.pull('busybox') c.pull('busybox')
unittest.main() unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment