mirror of https://github.com/docker/docker-py.git
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:
parent
272c1f8634
commit
e15b3bb689
|
@ -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):
|
||||||
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):
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
Loading…
Reference in New Issue