Pep8 fixes, implement pep8 check on tests subdir
Fixes bug #1053515 Change-Id: I2b886528c86e0ad5bdae5abf73890366f084e225
This commit is contained in:
parent
b0eb0b091e
commit
5f0bc1a6f1
@ -99,7 +99,8 @@ class TestNovaNotifier(base.TestCase):
|
|||||||
"ephemeral_gb": "0",
|
"ephemeral_gb": "0",
|
||||||
"vcpus": 1,
|
"vcpus": 1,
|
||||||
"host": "fakehost",
|
"host": "fakehost",
|
||||||
"availability_zone": "1e3ce043029547f1a61c1996d1a531a4",
|
"availability_zone":
|
||||||
|
"1e3ce043029547f1a61c1996d1a531a4",
|
||||||
"created_at": '2012-05-08 20:23:41',
|
"created_at": '2012-05-08 20:23:41',
|
||||||
"os_type": "linux",
|
"os_type": "linux",
|
||||||
"kernel_id": "kernelid",
|
"kernel_id": "kernelid",
|
||||||
@ -113,11 +114,13 @@ class TestNovaNotifier(base.TestCase):
|
|||||||
self.stubs.Set(db, 'instance_get', self.fake_db_instance_get)
|
self.stubs.Set(db, 'instance_get', self.fake_db_instance_get)
|
||||||
self.stubs.Set(db, 'instance_info_cache_delete', self.do_nothing)
|
self.stubs.Set(db, 'instance_info_cache_delete', self.do_nothing)
|
||||||
self.stubs.Set(db, 'instance_destroy', self.do_nothing)
|
self.stubs.Set(db, 'instance_destroy', self.do_nothing)
|
||||||
self.stubs.Set(db, 'instance_system_metadata_get', self.fake_db_instance_system_metadata_get)
|
self.stubs.Set(db, 'instance_system_metadata_get',
|
||||||
|
self.fake_db_instance_system_metadata_get)
|
||||||
self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
|
self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
|
||||||
lambda context, instance: {})
|
lambda context, instance: {})
|
||||||
self.stubs.Set(db, 'instance_update_and_get_original',
|
self.stubs.Set(db, 'instance_update_and_get_original',
|
||||||
lambda context, uuid, kwargs: (self.instance, self.instance))
|
lambda context, uuid, kwargs: (self.instance,
|
||||||
|
self.instance))
|
||||||
|
|
||||||
self.stubs.Set(publish, 'publish_counter', self.do_nothing)
|
self.stubs.Set(publish, 'publish_counter', self.do_nothing)
|
||||||
nova_notifier.notify.manager.pollsters = [('test', self.Pollster())]
|
nova_notifier.notify.manager.pollsters = [('test', self.Pollster())]
|
||||||
@ -128,6 +131,8 @@ class TestNovaNotifier(base.TestCase):
|
|||||||
|
|
||||||
def test_notifications(self):
|
def test_notifications(self):
|
||||||
self.compute.terminate_instance(self.context, instance=self.instance)
|
self.compute.terminate_instance(self.context, instance=self.instance)
|
||||||
self.assertEqual(self.Pollster.counters[0][0], nova_notifier.notify.manager)
|
self.assertEqual(self.Pollster.counters[0][0],
|
||||||
self.assertEqual(self.Pollster.counters[0][1].id, self.instance['uuid'])
|
nova_notifier.notify.manager)
|
||||||
|
self.assertEqual(self.Pollster.counters[0][1].id,
|
||||||
|
self.instance['uuid'])
|
||||||
self.assertEqual(len(self.Pollster.counters), 1)
|
self.assertEqual(len(self.Pollster.counters), 1)
|
||||||
|
@ -90,7 +90,8 @@ class TestImagePollster(base.TestCase):
|
|||||||
super(TestImagePollster, self).setUp()
|
super(TestImagePollster, self).setUp()
|
||||||
self.context = context.RequestContext('admin', 'admin', is_admin=True)
|
self.context = context.RequestContext('admin', 'admin', is_admin=True)
|
||||||
self.manager = manager.AgentManager()
|
self.manager = manager.AgentManager()
|
||||||
self.stubs.Set(glance._Base, 'iter_images', self.fake_glance_iter_images)
|
self.stubs.Set(glance._Base, 'iter_images',
|
||||||
|
self.fake_glance_iter_images)
|
||||||
|
|
||||||
def test_glance_image_counter(self):
|
def test_glance_image_counter(self):
|
||||||
counters = list(glance.ImagePollster().get_counters(self.manager,
|
counters = list(glance.ImagePollster().get_counters(self.manager,
|
||||||
@ -104,5 +105,6 @@ class TestImagePollster(base.TestCase):
|
|||||||
self.context))
|
self.context))
|
||||||
self.assertEqual(len(counters), 3)
|
self.assertEqual(len(counters), 3)
|
||||||
for image in IMAGE_LIST:
|
for image in IMAGE_LIST:
|
||||||
self.assert_(any(map(lambda counter: counter.volume == image['size'],
|
self.assert_(
|
||||||
|
any(map(lambda counter: counter.volume == image['size'],
|
||||||
counters)))
|
counters)))
|
||||||
|
@ -459,11 +459,9 @@ class TestGetEventInterval(MongoDBEngineTestBase):
|
|||||||
self.early1 = self.start - datetime.timedelta(minutes=20)
|
self.early1 = self.start - datetime.timedelta(minutes=20)
|
||||||
self.early2 = self.start - datetime.timedelta(minutes=10)
|
self.early2 = self.start - datetime.timedelta(minutes=10)
|
||||||
|
|
||||||
|
|
||||||
self.middle1 = self.start + datetime.timedelta(minutes=10)
|
self.middle1 = self.start + datetime.timedelta(minutes=10)
|
||||||
self.middle2 = self.end - datetime.timedelta(minutes=10)
|
self.middle2 = self.end - datetime.timedelta(minutes=10)
|
||||||
|
|
||||||
|
|
||||||
self.late1 = self.end + datetime.timedelta(minutes=10)
|
self.late1 = self.end + datetime.timedelta(minutes=10)
|
||||||
self.late2 = self.end + datetime.timedelta(minutes=20)
|
self.late2 = self.end + datetime.timedelta(minutes=20)
|
||||||
|
|
||||||
|
@ -74,7 +74,8 @@ class TestNotifications(unittest.TestCase):
|
|||||||
counters = v.process_notification(NOTIFICATION_VOLUME_EXISTS)
|
counters = v.process_notification(NOTIFICATION_VOLUME_EXISTS)
|
||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
c = counters[0]
|
c = counters[0]
|
||||||
self.assertEqual(c.volume, NOTIFICATION_VOLUME_EXISTS['payload']['size'])
|
self.assertEqual(c.volume,
|
||||||
|
NOTIFICATION_VOLUME_EXISTS['payload']['size'])
|
||||||
|
|
||||||
def test_volume_delete(self):
|
def test_volume_delete(self):
|
||||||
v = notifications.Volume()
|
v = notifications.Volume()
|
||||||
@ -88,4 +89,5 @@ class TestNotifications(unittest.TestCase):
|
|||||||
counters = v.process_notification(NOTIFICATION_VOLUME_EXISTS)
|
counters = v.process_notification(NOTIFICATION_VOLUME_EXISTS)
|
||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
c = counters[0]
|
c = counters[0]
|
||||||
self.assertEqual(c.volume, NOTIFICATION_VOLUME_EXISTS['payload']['size'])
|
self.assertEqual(c.volume,
|
||||||
|
NOTIFICATION_VOLUME_EXISTS['payload']['size'])
|
||||||
|
2
tox.ini
2
tox.ini
@ -18,7 +18,7 @@ commands = {toxinidir}/run_tests.sh --no-path-adjustment --with-coverage --cover
|
|||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps = pep8==1.1
|
deps = pep8==1.1
|
||||||
commands = pep8 --repeat --show-source ceilometer setup.py bin/ceilometer-agent-central bin/ceilometer-agent-compute bin/ceilometer-collector bin/ceilometer-api
|
commands = pep8 --repeat --show-source ceilometer setup.py bin/ceilometer-agent-central bin/ceilometer-agent-compute bin/ceilometer-collector bin/ceilometer-api tests
|
||||||
|
|
||||||
[testenv:py26-essex]
|
[testenv:py26-essex]
|
||||||
deps = -r{toxinidir}/tools/pip-requires_essex
|
deps = -r{toxinidir}/tools/pip-requires_essex
|
||||||
|
Loading…
Reference in New Issue
Block a user