BaseTestCase shims assertIn

This commit is contained in:
Joffrey F 2015-04-22 15:11:55 -07:00
parent 5b69cbf4ef
commit c7511481a6
2 changed files with 14 additions and 2 deletions

11
tests/base.py Normal file
View File

@ -0,0 +1,11 @@
import sys
import unittest
import six
class BaseTestCase(unittest.TestCase):
def assertIn(self, object, collection):
if six.PY2 and sys.version_info[1] <= 6:
return self.assertTrue(object in collection)
return super(BaseTestCase, self).assertIn(object, collection)

View File

@ -35,6 +35,7 @@ import docker
import requests
import six
import base
import fake_api
try:
@ -102,7 +103,7 @@ class Cleanup(object):
@mock.patch.multiple('docker.Client', get=fake_request, post=fake_request,
put=fake_request, delete=fake_request)
class DockerClientTest(Cleanup, unittest.TestCase):
class DockerClientTest(Cleanup, base.BaseTestCase):
def setUp(self):
self.client = docker.Client()
# Force-clear authconfig to avoid tampering with the tests
@ -2295,7 +2296,7 @@ class DockerClientTest(Cleanup, unittest.TestCase):
)
class StreamTest(Cleanup, unittest.TestCase):
class StreamTest(Cleanup, base.BaseTestCase):
def setUp(self):
socket_dir = tempfile.mkdtemp()