From: Victor Stinner Date: Wed, 7 Oct 2015 15:20:07 +0000 (+0200) Subject: Port image cache to Python 3 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cb0b687a5bfcbff090175ba8a6e4313e85e24e91;p=openstack-build%2Fcinder-build.git 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 --- diff --git a/cinder/image/cache.py b/cinder/image/cache.py index 8c24c93aa..54a5b2b0d 100644 --- a/cinder/image/cache.py +++ b/cinder/image/cache.py @@ -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')) diff --git a/tests-py3.txt b/tests-py3.txt index e933f6a31..b06d04072 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -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