Reset notifier_api before each test.

If tests are not run in the default order nosetests runs them in it
is possible that notifier_api in test_notifications.py and
test_compute_utils is in a state unsuitable for testing (notifier_api
may have had its drivers set elsewhere preventing it from picking up the
test driver). Reset the notifier_api before each test to ensure
notifier_api is usable for every test run regardless of test order.

Part of blueprint grizzly-testtools

Change-Id: I1f9282b96e2b2471eb8176b7ce9c95b4b1548ffe
This commit is contained in:
Clark Boylan 2012-11-30 13:23:27 -08:00
parent 529c89c247
commit c658a6f73b
2 changed files with 2 additions and 0 deletions

View File

@ -215,6 +215,7 @@ class UsageInfoTestCase(test.TestCase):
self.stubs.Set(network_api.API, 'get_instance_nw_info',
fake_get_nw_info)
notifier_api._reset_drivers()
self.flags(use_local=True, group='conductor')
self.flags(compute_driver='nova.virt.fake.FakeDriver',
notification_driver=[test_notifier.__name__],

View File

@ -54,6 +54,7 @@ class NotificationsTestCase(test.TestCase):
fake_get_nw_info)
fake_network.set_stub_network_methods(self.stubs)
notifier_api._reset_drivers()
self.flags(compute_driver='nova.virt.fake.FakeDriver',
notification_driver=[test_notifier.__name__],
network_manager='nova.network.manager.FlatManager',