Keep python 3.X compatibility for xrange
Use six.move.xrange instead of xrange. xrange is replaced by range in python3. closes-bug: #1291191 Change-Id: I95b68c055c4a7e7c0d77e08e6ce409cf1892ed56
This commit is contained in:
parent
a4ed60feed
commit
524eaeba94
@ -89,7 +89,7 @@ class QueueControllerTest(ControllerBaseTest):
|
||||
project_alt = self.project if project is None else None
|
||||
|
||||
num = 15
|
||||
for queue in xrange(num):
|
||||
for queue in six.moves.xrange(num):
|
||||
self.controller.create(str(queue), project=project)
|
||||
self.controller.create(str(queue), project=project_alt)
|
||||
|
||||
@ -835,7 +835,7 @@ def _insert_fixtures(controller, queue_name, project=None,
|
||||
client_uuid=None, num=4, ttl=120):
|
||||
|
||||
def messages():
|
||||
for n in xrange(num):
|
||||
for n in six.moves.xrange(num):
|
||||
yield {
|
||||
'ttl': ttl,
|
||||
'body': {
|
||||
|
@ -18,6 +18,7 @@ import random
|
||||
import uuid
|
||||
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
from marconi.openstack.common.cache import cache as oslo_cache
|
||||
from marconi.queues.storage import sharding
|
||||
@ -42,7 +43,7 @@ class ShardQueuesTest(testing.TestBase):
|
||||
self.controller = self.driver.queue_controller
|
||||
|
||||
# fake two shards
|
||||
for _ in xrange(2):
|
||||
for _ in six.moves.xrange(2):
|
||||
self.shards_ctrl.create(str(uuid.uuid1()), 100,
|
||||
'sqlite://:memory:')
|
||||
|
||||
@ -63,7 +64,7 @@ class ShardQueuesTest(testing.TestBase):
|
||||
|
||||
self.assertEqual(len(queues), 0)
|
||||
|
||||
for n in xrange(10):
|
||||
for n in six.moves.xrange(10):
|
||||
name = 'queue_%d' % n
|
||||
self.controller.create(name, project=project)
|
||||
self.controller.set_metadata(name,
|
||||
@ -88,9 +89,9 @@ class ShardQueuesTest(testing.TestBase):
|
||||
|
||||
# ordered by name as a whole
|
||||
self.assertTrue(all(queues[i]['name'] <= queues[i + 1]['name']
|
||||
for i in xrange(len(queues) - 1)))
|
||||
for i in six.moves.xrange(len(queues) - 1)))
|
||||
|
||||
for n in xrange(10):
|
||||
for n in six.moves.xrange(10):
|
||||
self.controller.delete('queue_%d' % n, project=project)
|
||||
|
||||
interaction = self.controller.list(project=project,
|
||||
|
Loading…
Reference in New Issue
Block a user