]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Port image cache to Python 3
authorVictor Stinner <vstinner@redhat.com>
Wed, 7 Oct 2015 15:20:07 +0000 (17:20 +0200)
committerVictor Stinner <vstinner@redhat.com>
Wed, 7 Oct 2015 15:20:48 +0000 (17:20 +0200)
* 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

cinder/image/cache.py
tests-py3.txt

index 8c24c93aad99e2433a1ad0a57675e44627fc27a2..54a5b2b0d70950ea341115296dfc96c22865f648 100644 (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'))
index e933f6a316be8899b3b6293e357bafaf33932538..b06d04072b23a63848f88438c288dc11d2fa8df2 100644 (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