Kaydet (Commit) d60cb317 authored tarafından Joffrey F's avatar Joffrey F

Merge branch 'aanand-pytest'

...@@ -10,6 +10,7 @@ dist ...@@ -10,6 +10,7 @@ dist
.tox .tox
.coverage .coverage
html/* html/*
tests/__pycache__
# Compiled Documentation # Compiled Documentation
site/ site/
...@@ -13,13 +13,13 @@ build-py3: ...@@ -13,13 +13,13 @@ build-py3:
test: unit-test integration-test unit-test-py3 integration-test-py3 test: unit-test integration-test unit-test-py3 integration-test-py3
unit-test: build unit-test: build
docker run docker-py python tests/test.py docker run docker-py py.test tests/test.py tests/utils_test.py
unit-test-py3: build-py3 unit-test-py3: build-py3
docker run docker-py3 python tests/test.py docker run docker-py3 py.test tests/test.py tests/utils_test.py
integration-test: build integration-test: build
docker run -e NOT_ON_HOST=true -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py python tests/integration_test.py docker run -e NOT_ON_HOST=true -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py py.test tests/integration_test.py
integration-test-py3: build-py3 integration-test-py3: build-py3
docker run -e NOT_ON_HOST=true -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py3 python tests/integration_test.py docker run -e NOT_ON_HOST=true -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py3 py.test tests/integration_test.py
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import fake_stat from . import fake_stat
CURRENT_VERSION = 'v1.19' CURRENT_VERSION = 'v1.19'
......
...@@ -33,7 +33,7 @@ import six ...@@ -33,7 +33,7 @@ import six
from six.moves import BaseHTTPServer from six.moves import BaseHTTPServer
from six.moves import socketserver from six.moves import socketserver
from test import Cleanup from .test import Cleanup
# FIXME: missing tests for # FIXME: missing tests for
# export; history; insert; port; push; tag; get; load; stats # export; history; insert; port; push; tag; get; load; stats
......
This diff is collapsed.
import os import os
import os.path import os.path
import unittest
import tempfile import tempfile
from docker.client import Client from docker.client import Client
...@@ -13,7 +12,9 @@ from docker.utils import ( ...@@ -13,7 +12,9 @@ from docker.utils import (
from docker.utils.ports import build_port_bindings, split_port from docker.utils.ports import build_port_bindings, split_port
from docker.auth import resolve_repository_name, resolve_authconfig from docker.auth import resolve_repository_name, resolve_authconfig
import base from . import base
import pytest
class UtilsTest(base.BaseTestCase): class UtilsTest(base.BaseTestCase):
...@@ -80,13 +81,8 @@ class UtilsTest(base.BaseTestCase): ...@@ -80,13 +81,8 @@ class UtilsTest(base.BaseTestCase):
} }
for host in invalid_hosts: for host in invalid_hosts:
try: with pytest.raises(DockerException):
parsed = parse_host(host) parse_host(host)
self.fail('Expected to fail but success: %s -> %s' % (
host, parsed
))
except DockerException:
pass
for host, expected in valid_hosts.items(): for host, expected in valid_hosts.items():
self.assertEqual(parse_host(host), expected, msg=host) self.assertEqual(parse_host(host), expected, msg=host)
...@@ -476,6 +472,3 @@ class UtilsTest(base.BaseTestCase): ...@@ -476,6 +472,3 @@ class UtilsTest(base.BaseTestCase):
["127.0.0.1:1000:1000", "127.0.0.1:2000:2000"]) ["127.0.0.1:1000:1000", "127.0.0.1:2000:2000"])
self.assertEqual(port_bindings["1000"], [("127.0.0.1", "1000")]) self.assertEqual(port_bindings["1000"], [("127.0.0.1", "1000")])
self.assertEqual(port_bindings["2000"], [("127.0.0.1", "2000")]) self.assertEqual(port_bindings["2000"], [("127.0.0.1", "2000")])
if __name__ == '__main__':
unittest.main()
...@@ -5,11 +5,7 @@ skipsdist=True ...@@ -5,11 +5,7 @@ skipsdist=True
[testenv] [testenv]
usedevelop=True usedevelop=True
commands = commands =
{envbindir}/coverage run -p tests/test.py py.test --cov=docker tests/test.py tests/utils_test.py
{envbindir}/coverage run -p tests/utils_test.py
{envbindir}/coverage combine
{envbindir}/coverage report
{envbindir}/coverage html
deps = deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
......
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