Port image cache to Python 3

* Replace [unicode, str] with six.string_types and use isinstance()
  to check the type
* tox.ini: add cinder.tests.unit.image.test_cache to Python 3.4

Partial-Implements: blueprint cinder-python3
Change-Id: Iba44a929bc8590e5b708074f8a17cc86b09e41bd
This commit is contained in:
Victor Stinner 2015-10-07 17:20:07 +02:00
parent a37618f55b
commit cb0b687a5b
2 changed files with 2 additions and 1 deletions

View File

@ -87,7 +87,7 @@ class ImageVolumeCache(object):
# we just need to parse it into one. If it is an actual datetime
# we want to just grab it as a UTC naive datetime.
image_updated_at = image_meta['updated_at']
if type(image_updated_at) in [unicode, str]:
if isinstance(image_updated_at, six.string_types):
image_updated_at = timeutils.parse_strtime(image_updated_at)
else:
image_updated_at = image_updated_at.astimezone(timezone('UTC'))

View File

@ -1,3 +1,4 @@
cinder.tests.unit.image.test_cache
cinder.tests.unit.image.test_glance
cinder.tests.unit.keymgr.test_mock_key_mgr
cinder.tests.unit.scheduler.test_allocated_capacity_weigher