Merge "Replace iterator.next() with next(iterator)"

This commit is contained in:
Jenkins 2014-07-28 13:11:49 +00:00 committed by Gerrit Code Review
commit 618387e8cf
4 changed files with 7 additions and 9 deletions

View File

@ -96,9 +96,9 @@ class CeilometerMiddleware(object):
def iter_response(iterable): def iter_response(iterable):
iterator = iter(iterable) iterator = iter(iterable)
try: try:
chunk = iterator.next() chunk = next(iterator)
while not chunk: while not chunk:
chunk = iterator.next() chunk = next(iterator)
except StopIteration: except StopIteration:
chunk = '' chunk = ''
@ -109,7 +109,7 @@ class CeilometerMiddleware(object):
while chunk: while chunk:
bytes_sent += len(chunk) bytes_sent += len(chunk)
yield chunk yield chunk
chunk = iterator.next() chunk = next(iterator)
finally: finally:
try: try:
self.publish_sample(env, self.publish_sample(env,

View File

@ -20,7 +20,6 @@
import time import time
import mock import mock
import six
from ceilometer.compute import manager from ceilometer.compute import manager
from ceilometer.compute.pollsters import cpu from ceilometer.compute.pollsters import cpu
@ -43,7 +42,7 @@ class TestCPUPollster(base.TestPollsterBase):
)) ))
def inspect_cpus(name): def inspect_cpus(name):
return six.next(next_value) return next(next_value)
self.inspector.inspect_cpus = mock.Mock(side_effect=inspect_cpus) self.inspector.inspect_cpus = mock.Mock(side_effect=inspect_cpus)
@ -92,7 +91,7 @@ class TestCPUUtilPollster(base.TestPollsterBase):
)) ))
def inspect_cpu_util(name, duration): def inspect_cpu_util(name, duration):
return six.next(next_value) return next(next_value)
self.inspector.inspect_cpu_util = (mock. self.inspector.inspect_cpu_util = (mock.
Mock(side_effect=inspect_cpu_util)) Mock(side_effect=inspect_cpu_util))

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
import mock import mock
import six
from ceilometer.compute import manager from ceilometer.compute import manager
from ceilometer.compute.pollsters import memory from ceilometer.compute.pollsters import memory
@ -35,7 +34,7 @@ class TestMemoryPollster(base.TestPollsterBase):
)) ))
def inspect_memory_usage(instance, duration): def inspect_memory_usage(instance, duration):
return six.next(next_value) return next(next_value)
(self.inspector. (self.inspector.
inspect_memory_usage) = mock.Mock(side_effect=inspect_memory_usage) inspect_memory_usage) = mock.Mock(side_effect=inspect_memory_usage)

View File

@ -43,7 +43,7 @@ class ProfilerNotificationsTestCase(test.BaseTestCase):
def test_process_notification(self): def test_process_notification(self):
prof = notifications.ProfilerNotifications(None) prof = notifications.ProfilerNotifications(None)
info = prof.process_notification(NOTIFICATION).next() info = next(prof.process_notification(NOTIFICATION))
self.assertEqual(NOTIFICATION["payload"]["name"], info.name) self.assertEqual(NOTIFICATION["payload"]["name"], info.name)
self.assertEqual(sample.TYPE_GAUGE, info.type) self.assertEqual(sample.TYPE_GAUGE, info.type)