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
This commit is contained in:
Michael Merickel 2014-07-05 14:54:36 -05:00
parent 272c1f8634
commit e15b3bb689
1 changed files with 4 additions and 2 deletions

View File

@ -28,6 +28,8 @@ import six
# FIXME: missing tests for
# export; history; import_image; insert; port; push; tag; get; load
DEFAULT_BASE_URL = os.environ.get('DOCKER_HOST')
class BaseTestCase(unittest.TestCase):
tmp_imgs = []
@ -35,7 +37,7 @@ class BaseTestCase(unittest.TestCase):
tmp_folders = []
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_containers = []
self.tmp_folders = []
@ -910,6 +912,6 @@ class TestConnectionTimeout(unittest.TestCase):
if __name__ == '__main__':
c = docker.Client()
c = docker.Client(base_url=DEFAULT_BASE_URL)
c.pull('busybox')
unittest.main()