diff options
author | Victor Stinner <vstinner@redhat.com> | 2015-05-20 11:29:30 -0700 |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2015-05-20 12:47:02 -0700 |
commit | e6d19f151f8f7c9729af44fbc88ee6d5babafc3a (patch) | |
tree | 9c39fa780075f2eafab77fb960f789b97705bdd7 /glance_store/tests/base.py | |
parent | 7f6a18b041eba88133db7ac5518cb2163bee7e03 (diff) | |
download | glance_store-e6d19f151f8f7c9729af44fbc88ee6d5babafc3a.tar.gz |
Fix Python 3 issues
* Replace it.next() with next(it)
* Replace dict.iteritems() with six.iteritems(dict)
* Replace unicode with six.text_type
* Replace dict(d1.items() + {'Cookie': cookie}.items()) with:
d3=dict(d1); d3['Cookie'] = cookie
* Replace map(func, parts) with [func(part) for part in parts]
* Open file in binary mode (not in text mode) to load JSON using
jsonutils.load()
* Avoid using dict.keys()[0] or dict.values()[0]: on Python 3, keys()
and values() methods of dictionaries return iterators, not lists
For more information on Python 3, see:
https://wiki.openstack.org/wiki/Python3
Change-Id: Ib09a3367d8dcb664911a0b187da9e363a96727fd
Diffstat (limited to 'glance_store/tests/base.py')
-rw-r--r-- | glance_store/tests/base.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/glance_store/tests/base.py b/glance_store/tests/base.py index 4df57ad..6deba08 100644 --- a/glance_store/tests/base.py +++ b/glance_store/tests/base.py @@ -20,6 +20,7 @@ import shutil import fixtures from oslo_config import cfg from oslotest import base +import six import glance_store as store from glance_store import location @@ -66,7 +67,7 @@ class StoreBaseTest(base.BaseTestCase): test by the fixtures cleanup process. """ group = kw.pop('group', 'glance_store') - for k, v in kw.iteritems(): + for k, v in six.iteritems(kw): self.conf.set_override(k, v, group) def register_store_schemes(self, store, store_entry): |