From cb0b687a5bfcbff090175ba8a6e4313e85e24e91 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 7 Oct 2015 17:20:07 +0200 Subject: [PATCH] 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 --- cinder/image/cache.py | 2 +- tests-py3.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 -- 2.45.2