Pep8 fixes, implement pep8 check on tests subdir
Fixes bug #1053515 Change-Id: I2b886528c86e0ad5bdae5abf73890366f084e225
This commit is contained in:
parent
b0eb0b091e
commit
5f0bc1a6f1
@ -132,7 +132,7 @@ class TestNetPollster(test_base.TestCase):
|
||||
domain.XMLDesc(0).AndReturn(dom_xml)
|
||||
self.mox.ReplayAll()
|
||||
interfaces = self.pollster._get_vnics(conn, self.instance)
|
||||
self.assertTrue('vnet1' in [x['name'] for x in interfaces])
|
||||
self.assertTrue('vnet1' in [x['name'] for x in interfaces])
|
||||
self.assertTrue('fa:16:3e:71:ec:6d', [x['mac'] for x in interfaces])
|
||||
self.assertTrue([x['dhcpserver'] for x in interfaces])
|
||||
|
||||
|
@ -99,7 +99,8 @@ class TestNovaNotifier(base.TestCase):
|
||||
"ephemeral_gb": "0",
|
||||
"vcpus": 1,
|
||||
"host": "fakehost",
|
||||
"availability_zone": "1e3ce043029547f1a61c1996d1a531a4",
|
||||
"availability_zone":
|
||||
"1e3ce043029547f1a61c1996d1a531a4",
|
||||
"created_at": '2012-05-08 20:23:41',
|
||||
"os_type": "linux",
|
||||
"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_info_cache_delete', 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',
|
||||
lambda context, instance: {})
|
||||
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)
|
||||
nova_notifier.notify.manager.pollsters = [('test', self.Pollster())]
|
||||
@ -128,6 +131,8 @@ class TestNovaNotifier(base.TestCase):
|
||||
|
||||
def test_notifications(self):
|
||||
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][1].id, self.instance['uuid'])
|
||||
self.assertEqual(self.Pollster.counters[0][0],
|
||||
nova_notifier.notify.manager)
|
||||
self.assertEqual(self.Pollster.counters[0][1].id,
|
||||
self.instance['uuid'])
|
||||
self.assertEqual(len(self.Pollster.counters), 1)
|
||||
|
@ -90,7 +90,8 @@ class TestImagePollster(base.TestCase):
|
||||
super(TestImagePollster, self).setUp()
|
||||
self.context = context.RequestContext('admin', 'admin', is_admin=True)
|
||||
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):
|
||||
counters = list(glance.ImagePollster().get_counters(self.manager,
|
||||
@ -104,5 +105,6 @@ class TestImagePollster(base.TestCase):
|
||||
self.context))
|
||||
self.assertEqual(len(counters), 3)
|
||||
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)))
|
||||
|
@ -459,11 +459,9 @@ class TestGetEventInterval(MongoDBEngineTestBase):
|
||||
self.early1 = self.start - datetime.timedelta(minutes=20)
|
||||
self.early2 = self.start - datetime.timedelta(minutes=10)
|
||||
|
||||
|
||||
self.middle1 = self.start + datetime.timedelta(minutes=10)
|
||||
self.middle2 = self.end - datetime.timedelta(minutes=10)
|
||||
|
||||
|
||||
self.late1 = self.end + datetime.timedelta(minutes=10)
|
||||
self.late2 = self.end + datetime.timedelta(minutes=20)
|
||||
|
||||
|
@ -74,7 +74,8 @@ class TestNotifications(unittest.TestCase):
|
||||
counters = v.process_notification(NOTIFICATION_VOLUME_EXISTS)
|
||||
self.assertEqual(len(counters), 1)
|
||||
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):
|
||||
v = notifications.Volume()
|
||||
@ -88,4 +89,5 @@ class TestNotifications(unittest.TestCase):
|
||||
counters = v.process_notification(NOTIFICATION_VOLUME_EXISTS)
|
||||
self.assertEqual(len(counters), 1)
|
||||
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]
|
||||
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]
|
||||
deps = -r{toxinidir}/tools/pip-requires_essex
|
||||
|
Loading…
Reference in New Issue
Block a user