diff options
author | Eric Fried <openstack@fried.cc> | 2019-10-29 15:55:11 -0500 |
---|---|---|
committer | Eric Fried <openstack@fried.cc> | 2019-10-31 00:17:35 +0000 |
commit | f1d742f32adeb662a3fdf8fa3ef3bc391e71ed81 (patch) | |
tree | a6902ba864883a2e0315114f052968dc2c8c0d20 /openstackclient/tests/functional/identity | |
parent | 45af14ca72b44c03f14189ac61a29253faf03bd7 (diff) | |
download | python-openstackclient-f1d742f32adeb662a3fdf8fa3ef3bc391e71ed81.tar.gz |
Fix functional tests for py3
Fix various things so the functional tests will work under python3:
- A hashlib.md5() can only be update()d with an encoded string in py3.
- There's no dict.iteritems(), change to dict.items() (which is already
an iterator).
- Open temp files with 'w+' mode rather than the default 'w+b' (as an
alternative to encoding all the write and expected-read payloads as
bytes).
- (This is a weird one) Explicitly raise SkipTest from unittest (rather
than unittest2, which is where cls.skipException landed). Not sure why
this is busted, but this moves the ball.
Change-Id: Ic9b2b47848a600e87a3674289ae7ae8c3e091fee
Diffstat (limited to 'openstackclient/tests/functional/identity')
-rw-r--r-- | openstackclient/tests/functional/identity/v2/common.py | 3 | ||||
-rw-r--r-- | openstackclient/tests/functional/identity/v3/common.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/openstackclient/tests/functional/identity/v2/common.py b/openstackclient/tests/functional/identity/v2/common.py index f4bc10bd..43c0cbf2 100644 --- a/openstackclient/tests/functional/identity/v2/common.py +++ b/openstackclient/tests/functional/identity/v2/common.py @@ -11,6 +11,7 @@ # under the License. import os +import unittest import fixtures from tempest.lib.common.utils import data_utils @@ -62,7 +63,7 @@ class IdentityTests(base.TestCase): # TODO(dtroyer): Actually determine if Identity v2 admin is # enabled in the target cloud. Tuens out OSC # doesn't make this easy as it should (yet). - raise cls.skipException('No Identity v2 admin endpoint?') + raise unittest.case.SkipTest('No Identity v2 admin endpoint?') @classmethod def tearDownClass(cls): diff --git a/openstackclient/tests/functional/identity/v3/common.py b/openstackclient/tests/functional/identity/v3/common.py index 43b416aa..86f090bc 100644 --- a/openstackclient/tests/functional/identity/v3/common.py +++ b/openstackclient/tests/functional/identity/v3/common.py @@ -360,7 +360,7 @@ class IdentityTests(base.TestCase): def _extract_value_from_items(self, key, items): for d in items: - for k, v in d.iteritems(): + for k, v in d.items(): if k == key: return v |