From ca81d8c91f594c10ff695623383834c8464aa21e Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Fri, 7 Sep 2012 09:23:58 +0100 Subject: [PATCH] Simplify setting up test notifier Rather than duplicating the test notifier module name, just use the __name__ attribute on the module itself. Also, where we were using stubout to set the notification_driver flag, switch to using cfg's set_override() mechanism. Change-Id: I46f705f71a4a220c235618491e06602fa4ea7a47 --- nova/tests/test_volume.py | 5 ++--- nova/tests/test_volume_utils.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/nova/tests/test_volume.py b/nova/tests/test_volume.py index 44735bf7c..a147a3a99 100644 --- a/nova/tests/test_volume.py +++ b/nova/tests/test_volume.py @@ -51,9 +51,8 @@ class VolumeTestCase(test.TestCase): self.compute = importutils.import_object(FLAGS.compute_manager) vol_tmpdir = tempfile.mkdtemp() self.flags(compute_driver='nova.virt.fake.FakeDriver', - volumes_dir=vol_tmpdir) - self.stubs.Set(nova.flags.FLAGS, 'notification_driver', - ['nova.openstack.common.notifier.test_notifier']) + volumes_dir=vol_tmpdir, + notification_driver=[test_notifier.__name__]) self.stubs.Set(iscsi.TgtAdm, '_get_target', self.fake_get_target) self.volume = importutils.import_object(FLAGS.volume_manager) self.context = context.get_admin_context() diff --git a/nova/tests/test_volume_utils.py b/nova/tests/test_volume_utils.py index 66b00d48f..89ad7c3db 100644 --- a/nova/tests/test_volume_utils.py +++ b/nova/tests/test_volume_utils.py @@ -38,9 +38,8 @@ class UsageInfoTestCase(test.TestCase): def setUp(self): super(UsageInfoTestCase, self).setUp() self.flags(compute_driver='nova.virt.fake.FakeDriver', - host='fake') - self.stubs.Set(flags.FLAGS, 'notification_driver', - ['nova.openstack.common.notifier.test_notifier']) + host='fake', + notification_driver=[test_notifier.__name__]) fake_network.set_stub_network_methods(self.stubs) self.volume = importutils.import_object(FLAGS.volume_manager)