Mixins for tests confuse pylint no end, and aren't necessary... you can stop the base-class from being run as a test by prefixing the class name with an underscore

This commit is contained in:
Justin Santa Barbara
2011-03-28 16:57:04 +00:00
committed by Tarmac
2 changed files with 12 additions and 9 deletions

View File

@@ -43,9 +43,14 @@ from nova.tests.api.openstack import fakes
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
class BaseImageServiceTests(object): class _BaseImageServiceTests(test.TestCase):
"""Tasks to test for all image services""" """Tasks to test for all image services"""
def __init__(self, *args, **kwargs):
super(_BaseImageServiceTests, self).__init__(*args, **kwargs)
self.service = None
self.context = None
def test_create(self): def test_create(self):
fixture = self._make_fixture('test image') fixture = self._make_fixture('test image')
num_images = len(self.service.index(self.context)) num_images = len(self.service.index(self.context))
@@ -116,8 +121,7 @@ class BaseImageServiceTests(object):
return fixture return fixture
class LocalImageServiceTest(test.TestCase, class LocalImageServiceTest(_BaseImageServiceTests):
BaseImageServiceTests):
"""Tests the local image service""" """Tests the local image service"""
@@ -147,8 +151,7 @@ class LocalImageServiceTest(test.TestCase,
self.assertEqual(3, len(found_image_ids), len(found_image_ids)) self.assertEqual(3, len(found_image_ids), len(found_image_ids))
class GlanceImageServiceTest(test.TestCase, class GlanceImageServiceTest(_BaseImageServiceTests):
BaseImageServiceTests):
"""Tests the Glance image service, in particular that metadata translation """Tests the Glance image service, in particular that metadata translation
works properly. works properly.

View File

@@ -80,10 +80,10 @@ class user_and_project_generator(object):
self.manager.delete_project(self.project) self.manager.delete_project(self.project)
class AuthManagerTestCase(object): class _AuthManagerBaseTestCase(test.TestCase):
def setUp(self): def setUp(self):
FLAGS.auth_driver = self.auth_driver FLAGS.auth_driver = self.auth_driver
super(AuthManagerTestCase, self).setUp() super(_AuthManagerBaseTestCase, self).setUp()
self.flags(connection_type='fake') self.flags(connection_type='fake')
self.manager = manager.AuthManager(new=True) self.manager = manager.AuthManager(new=True)
@@ -331,11 +331,11 @@ class AuthManagerTestCase(object):
self.assertTrue(user.is_admin()) self.assertTrue(user.is_admin())
class AuthManagerLdapTestCase(AuthManagerTestCase, test.TestCase): class AuthManagerLdapTestCase(_AuthManagerBaseTestCase):
auth_driver = 'nova.auth.ldapdriver.FakeLdapDriver' auth_driver = 'nova.auth.ldapdriver.FakeLdapDriver'
class AuthManagerDbTestCase(AuthManagerTestCase, test.TestCase): class AuthManagerDbTestCase(_AuthManagerBaseTestCase):
auth_driver = 'nova.auth.dbdriver.DbDriver' auth_driver = 'nova.auth.dbdriver.DbDriver'