diff options
| author | Yaguang Tang <heut2008@gmail.com> | 2012-06-30 02:13:05 +0800 |
|---|---|---|
| committer | Yaguang Tang <heut2008@gmail.com> | 2012-07-18 11:40:09 +0800 |
| commit | d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0 (patch) | |
| tree | 3614b8d9bfe55bdebddc700c06ffb8fc45e76e92 /tests | |
| parent | ace759e55d7c87dc66a500d598d1355dd3c0408f (diff) | |
| download | oslo-d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0.tar.gz oslo-d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0.tar.xz oslo-d5f2152dcfc4039de8324bdf75f6a2cd844dbdd0.zip | |
fix bug lp:1019348,update openstack-common to support pep8 1.3.
also,this patch turns off pep8 E125 check.
Change-Id: I22d2a94d89530586d614af39af17ae542c5e0cbf
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/notifier/test_list_notifier.py | 42 | ||||
| -rw-r--r-- | tests/unit/plugin/test_callback_plugin.py | 2 | ||||
| -rw-r--r-- | tests/unit/test_importutils.py | 4 | ||||
| -rw-r--r-- | tests/unit/test_log.py | 10 | ||||
| -rw-r--r-- | tests/unit/test_notifier.py | 30 | ||||
| -rw-r--r-- | tests/unit/test_plugin.py | 6 |
6 files changed, 47 insertions, 47 deletions
diff --git a/tests/unit/notifier/test_list_notifier.py b/tests/unit/notifier/test_list_notifier.py index 5708a43..c441067 100644 --- a/tests/unit/notifier/test_list_notifier.py +++ b/tests/unit/notifier/test_list_notifier.py @@ -42,7 +42,7 @@ class NotifierListTestCase(test_utils.BaseTestCase): self.exception_count = 0 list_notifier_log = logging.getLogger( - 'openstack.common.notifier.list_notifier') + 'openstack.common.notifier.list_notifier') self.stubs.Set(list_notifier_log, "exception", mock_exception) # Mock no_op notifier to add one to notify_count when called. @@ -65,11 +65,11 @@ class NotifierListTestCase(test_utils.BaseTestCase): def test_send_notifications_successfully(self): self.config(notification_driver='openstack.common.' 'notifier.list_notifier', - list_notifier_drivers=[ - 'openstack.common.notifier.no_op_notifier', - 'openstack.common.notifier.no_op_notifier']) + list_notifier_drivers=[ + 'openstack.common.notifier.no_op_notifier', + 'openstack.common.notifier.no_op_notifier']) api.notify('contextarg', 'publisher_id', 'event_type', - api.WARN, dict(a=3)) + api.WARN, dict(a=3)) self.assertEqual(self.notify_count, 2) self.assertEqual(self.exception_count, 0) @@ -77,23 +77,23 @@ class NotifierListTestCase(test_utils.BaseTestCase): self.config(notification_driver='openstack.common.' 'notifier.list_notifier', - list_notifier_drivers=[ - 'openstack.common.notifier.no_op_notifier', - 'openstack.common.notifier.log_notifier']) + list_notifier_drivers=[ + 'openstack.common.notifier.no_op_notifier', + 'openstack.common.notifier.log_notifier']) api.notify('contextarg', 'publisher_id', - 'event_type', api.WARN, dict(a=3)) + 'event_type', api.WARN, dict(a=3)) self.assertEqual(self.notify_count, 1) self.assertEqual(self.exception_count, 1) def test_when_driver_fails_to_import(self): self.config(notification_driver='openstack.common.' 'notifier.list_notifier', - list_notifier_drivers=[ - 'openstack.common.notifier.no_op_notifier', - 'openstack.common.notifier.logo_notifier', - 'fdsjgsdfhjkhgsfkj']) + list_notifier_drivers=[ + 'openstack.common.notifier.no_op_notifier', + 'openstack.common.notifier.logo_notifier', + 'fdsjgsdfhjkhgsfkj']) api.notify('contextarg', 'publisher_id', - 'event_type', api.WARN, dict(a=3)) + 'event_type', api.WARN, dict(a=3)) self.assertEqual(self.exception_count, 2) self.assertEqual(self.notify_count, 1) @@ -101,12 +101,12 @@ class NotifierListTestCase(test_utils.BaseTestCase): self.notifier_object = SimpleNotifier() self.config(notification_driver='openstack.common.' 'notifier.list_notifier', - list_notifier_drivers=[ - 'openstack.common.notifier.no_op_notifier']) + list_notifier_drivers=[ + 'openstack.common.notifier.no_op_notifier']) list_notifier.add_driver(self.notifier_object) api.notify(None, 'publisher_id', 'event_type', - api.WARN, dict(a=3)) + api.WARN, dict(a=3)) self.assertEqual(self.notify_count, 1) self.assertTrue(self.notifier_object.notified) @@ -114,22 +114,22 @@ class NotifierListTestCase(test_utils.BaseTestCase): list_notifier.remove_driver(self.notifier_object) api.notify(None, 'publisher_id', 'event_type', - api.WARN, dict(a=3)) + api.WARN, dict(a=3)) self.assertEqual(self.notify_count, 2) self.assertFalse(self.notifier_object.notified) def test_adding_and_removing_notifier_module(self): self.config(notification_driver='openstack.common.' 'notifier.list_notifier', - list_notifier_drivers=[]) + list_notifier_drivers=[]) list_notifier.add_driver('openstack.common.notifier.no_op_notifier') api.notify(None, 'publisher_id', 'event_type', - api.WARN, dict(a=3)) + api.WARN, dict(a=3)) self.assertEqual(self.notify_count, 1) list_notifier.remove_driver('openstack.common.notifier.no_op_notifier') api.notify(None, 'publisher_id', 'event_type', - api.WARN, dict(a=3)) + api.WARN, dict(a=3)) self.assertEqual(self.notify_count, 1) diff --git a/tests/unit/plugin/test_callback_plugin.py b/tests/unit/plugin/test_callback_plugin.py index a950392..c747ec8 100644 --- a/tests/unit/plugin/test_callback_plugin.py +++ b/tests/unit/plugin/test_callback_plugin.py @@ -59,7 +59,7 @@ class CallbackTestCase(test_utils.BaseTestCase): return [MockEntrypoint("fake", "fake", ["fake"])] self.stubs.Set(pkg_resources, 'iter_entry_points', - mock_iter_entry_points) + mock_iter_entry_points) plugmgr = pluginmanager.PluginManager("testproject", "testservice") plugmgr.load_plugins() diff --git a/tests/unit/test_importutils.py b/tests/unit/test_importutils.py index c41f13b..4c9ff73 100644 --- a/tests/unit/test_importutils.py +++ b/tests/unit/test_importutils.py @@ -65,7 +65,7 @@ class ImportUtilsTest(unittest.TestCase): def test_import_object_ns_optional_arg_present(self): obj = importutils.import_object_ns('tests.unit', 'fake.FakeDriver', - first_arg=False) + first_arg=False) self.assertTrue(obj.__class__.__name__, 'FakeDriver') def test_import_object_ns_required_arg_not_present(self): @@ -75,7 +75,7 @@ class ImportUtilsTest(unittest.TestCase): def test_import_object_ns_required_arg_present(self): obj = importutils.import_object_ns('tests.unit', 'fake.FakeDriver2', - first_arg=False) + first_arg=False) self.assertTrue(obj.__class__.__name__, 'FakeDriver2') # namespace tests diff --git a/tests/unit/test_log.py b/tests/unit/test_log.py index 8eaffca..83c318f 100644 --- a/tests/unit/test_log.py +++ b/tests/unit/test_log.py @@ -59,12 +59,12 @@ class LogHandlerTestCase(test_utils.BaseTestCase): def test_log_path_logdir(self): self.config(logdir='/some/path', logfile=None) self.assertEquals(log._get_log_file_path(binary='foo-bar'), - '/some/path/foo-bar.log') + '/some/path/foo-bar.log') def test_log_path_logfile(self): self.config(logfile='/some/path/foo-bar.log') self.assertEquals(log._get_log_file_path(binary='foo-bar'), - '/some/path/foo-bar.log') + '/some/path/foo-bar.log') def test_log_path_none(self): self.config(logdir=None, logfile=None) @@ -72,9 +72,9 @@ class LogHandlerTestCase(test_utils.BaseTestCase): def test_log_path_logfile_overrides_logdir(self): self.config(logdir='/some/other/path', - logfile='/some/path/foo-bar.log') + logfile='/some/path/foo-bar.log') self.assertEquals(log._get_log_file_path(binary='foo-bar'), - '/some/path/foo-bar.log') + '/some/path/foo-bar.log') class PublishErrorsHandlerTestCase(test_utils.BaseTestCase): @@ -117,7 +117,7 @@ class LoggerTestCase(test_utils.BaseTestCase): levels = CONF.default_log_levels levels.append("nova-test=AUDIT") self.config(default_log_levels=levels, - verbose=True) + verbose=True) log.setup('testing') self.log = log.getLogger('nova-test') diff --git a/tests/unit/test_notifier.py b/tests/unit/test_notifier.py index 4e1c812..0ffc35c 100644 --- a/tests/unit/test_notifier.py +++ b/tests/unit/test_notifier.py @@ -42,7 +42,7 @@ class NotifierTestCase(test_utils.BaseTestCase): self.notify_called = True self.stubs.Set(no_op_notifier, 'notify', - mock_notify) + mock_notify) notifier_api.notify(ctxt, 'publisher_id', 'event_type', notifier_api.WARN, dict(a=3)) @@ -64,13 +64,13 @@ class NotifierTestCase(test_utils.BaseTestCase): self.assertEqual(context, ctxt) self.stubs.Set(no_op_notifier, 'notify', - message_assert) + message_assert) notifier_api.notify(ctxt, 'publisher_id', 'event_type', notifier_api.WARN, dict(a=3)) def test_send_rabbit_notification(self): self.stubs.Set(cfg.CONF, 'notification_driver', - 'openstack.common.notifier.rabbit_notifier') + 'openstack.common.notifier.rabbit_notifier') self.mock_notify = False def mock_notify(cls, *args): @@ -84,12 +84,12 @@ class NotifierTestCase(test_utils.BaseTestCase): def test_invalid_priority(self): self.assertRaises(notifier_api.BadPriorityException, - notifier_api.notify, ctxt, 'publisher_id', - 'event_type', 'not a priority', dict(a=3)) + notifier_api.notify, ctxt, 'publisher_id', + 'event_type', 'not a priority', dict(a=3)) def test_rabbit_priority_queue(self): self.stubs.Set(cfg.CONF, 'notification_driver', - 'openstack.common.notifier.rabbit_notifier') + 'openstack.common.notifier.rabbit_notifier') self.stubs.Set(cfg.CONF, 'notification_topics', ['testnotify', ]) @@ -105,7 +105,7 @@ class NotifierTestCase(test_utils.BaseTestCase): def test_error_notification(self): self.stubs.Set(cfg.CONF, 'notification_driver', - 'openstack.common.notifier.rabbit_notifier') + 'openstack.common.notifier.rabbit_notifier') self.stubs.Set(cfg.CONF, 'publish_errors', True) LOG = log.getLogger('common') log.setup(None) @@ -129,14 +129,14 @@ class NotifierTestCase(test_utils.BaseTestCase): return arg1 + arg2 example_api = notifier_api.notify_decorator( - 'example_api', - example_api) + 'example_api', + example_api) def mock_notify(cls, *args): self.notify_called = True self.stubs.Set(no_op_notifier, 'notify', - mock_notify) + mock_notify) self.assertEqual(3, example_api(1, 2)) self.assertEqual(self.notify_called, True) @@ -153,19 +153,19 @@ class NotifierTestCase(test_utils.BaseTestCase): return arg1 + arg2 example_api = notifier_api.notify_decorator( - 'example_api', - example_api) + 'example_api', + example_api) example_api2 = notifier_api.notify_decorator( - 'example_api2', - example_api2) + 'example_api2', + example_api2) def mock_notify(context, cls, _type, _priority, _payload): self.notify_called = True self.context_arg = context self.stubs.Set(notifier_api, 'notify', - mock_notify) + mock_notify) # Test positional context self.assertEqual(3, example_api(1, 2, ctxt)) diff --git a/tests/unit/test_plugin.py b/tests/unit/test_plugin.py index 01665ba..31f2e7a 100644 --- a/tests/unit/test_plugin.py +++ b/tests/unit/test_plugin.py @@ -57,7 +57,7 @@ class NotifyTestCase(test_utils.BaseTestCase): # Set up a 'normal' notifier to make sure the plugin logic # doesn't mess anything up. self.stubs.Set(cfg.CONF, 'notification_driver', - SimplerNotifier()) + SimplerNotifier()) global simpler_notify_called simpler_notify_called = False @@ -82,7 +82,7 @@ class NotifyTestCase(test_utils.BaseTestCase): return [MockEntrypoint("fake", "fake", ["fake"])] self.stubs.Set(pkg_resources, 'iter_entry_points', - mock_iter_entry_points) + mock_iter_entry_points) plugmgr = pluginmanager.PluginManager("testproject", "testservice") plugmgr.load_plugins() @@ -141,7 +141,7 @@ class APITestCase(test_utils.BaseTestCase): return [MockEntrypoint("fake", "fake", ["fake"])] self.stubs.Set(pkg_resources, 'iter_entry_points', - mock_iter_entry_points) + mock_iter_entry_points) stubLoaded = False |
