diff options
Diffstat (limited to 'tests/utils_test.py')
-rw-r--r-- | tests/utils_test.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/utils_test.py b/tests/utils_test.py index f10b0d0..a72a429 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -1,6 +1,5 @@ import os import os.path -import unittest import tempfile from docker.client import Client @@ -13,7 +12,9 @@ from docker.utils import ( from docker.utils.ports import build_port_bindings, split_port from docker.auth import resolve_repository_name, resolve_authconfig -import base +from . import base + +import pytest class UtilsTest(base.BaseTestCase): @@ -80,13 +81,8 @@ class UtilsTest(base.BaseTestCase): } for host in invalid_hosts: - try: - parsed = parse_host(host) - self.fail('Expected to fail but success: %s -> %s' % ( - host, parsed - )) - except DockerException: - pass + with pytest.raises(DockerException): + parse_host(host) for host, expected in valid_hosts.items(): self.assertEqual(parse_host(host), expected, msg=host) @@ -476,6 +472,3 @@ class UtilsTest(base.BaseTestCase): ["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["2000"], [("127.0.0.1", "2000")]) - -if __name__ == '__main__': - unittest.main() |