From a7990e0263f2113e3814209118ecb2afc140826e Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Wed, 16 Mar 2011 15:01:10 -0700 Subject: Use _ trick to hide base test class, thereby avoiding mixins and helping PyLint --- nova/tests/test_auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/test_auth.py b/nova/tests/test_auth.py index 2a7817032..0d24e5db2 100644 --- a/nova/tests/test_auth.py +++ b/nova/tests/test_auth.py @@ -80,10 +80,10 @@ class user_and_project_generator(object): self.manager.delete_project(self.project) -class AuthManagerTestCase(object): +class _AuthManagerBaseTestCase(test.TestCase): def setUp(self): FLAGS.auth_driver = self.auth_driver - super(AuthManagerTestCase, self).setUp() + super(_AuthManagerBaseTestCase, self).setUp() self.flags(connection_type='fake') self.manager = manager.AuthManager(new=True) @@ -324,11 +324,11 @@ class AuthManagerTestCase(object): self.assertTrue(user.is_admin()) -class AuthManagerLdapTestCase(AuthManagerTestCase, test.TestCase): +class AuthManagerLdapTestCase(_AuthManagerBaseTestCase): auth_driver = 'nova.auth.ldapdriver.FakeLdapDriver' -class AuthManagerDbTestCase(AuthManagerTestCase, test.TestCase): +class AuthManagerDbTestCase(_AuthManagerBaseTestCase): auth_driver = 'nova.auth.dbdriver.DbDriver' -- cgit From 65b11b3b9c76db2440d480bbc41b72f24bee8afc Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Wed, 16 Mar 2011 15:11:39 -0700 Subject: Avoid mixins on image tests, keeping pylint much happier --- nova/tests/api/openstack/test_images.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index 76f758929..9a33236af 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -41,10 +41,15 @@ from nova.tests.api.openstack import fakes FLAGS = flags.FLAGS -class BaseImageServiceTests(object): +class _BaseImageServiceTests(test.TestCase): """Tasks to test for all image services""" + def __init__(self): + super(_BaseImageServiceTests, self).__init__() + self.service = None + self.context = None + def test_create(self): fixture = {'name': 'test image', @@ -132,8 +137,7 @@ class BaseImageServiceTests(object): self.assertEquals(1, num_images) -class LocalImageServiceTest(test.TestCase, - BaseImageServiceTests): +class LocalImageServiceTest(_BaseImageServiceTests): """Tests the local image service""" @@ -152,8 +156,7 @@ class LocalImageServiceTest(test.TestCase, super(LocalImageServiceTest, self).tearDown() -class GlanceImageServiceTest(test.TestCase, - BaseImageServiceTests): +class GlanceImageServiceTest(_BaseImageServiceTests): """Tests the local image service""" -- cgit From aecd4eb9d363875cd84be5aa6fdb9afeb500b4f4 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Wed, 16 Mar 2011 15:44:45 -0700 Subject: Fix __init__ method on unit tests (they take a method_name kwarg) --- nova/tests/api/openstack/test_images.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index 9a33236af..8814b9b1a 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -45,8 +45,8 @@ class _BaseImageServiceTests(test.TestCase): """Tasks to test for all image services""" - def __init__(self): - super(_BaseImageServiceTests, self).__init__() + def __init__(self, *args, **kwargs): + super(_BaseImageServiceTests, self).__init__(*args, **kwargs) self.service = None self.context = None -- cgit