diff options
| author | Eric Fried <openstack@fried.cc> | 2019-10-29 15:55:11 -0500 |
|---|---|---|
| committer | Keith Berger <keith.berger@suse.com> | 2020-01-06 23:33:21 +0000 |
| commit | b866202f54afddca66a77cd989b082e193a96956 (patch) | |
| tree | 7a582ad4eb651939d9fa396f65297ff974ff955a /openstackclient/tests/functional/object | |
| parent | 6d8c4a1080431d19c79dfe04b9c484f87891fc53 (diff) | |
| download | python-openstackclient-b866202f54afddca66a77cd989b082e193a96956.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
(cherry picked from commit f1d742f32adeb662a3fdf8fa3ef3bc391e71ed81)
Diffstat (limited to 'openstackclient/tests/functional/object')
| -rw-r--r-- | openstackclient/tests/functional/object/v1/test_object.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/openstackclient/tests/functional/object/v1/test_object.py b/openstackclient/tests/functional/object/v1/test_object.py index 226ef8ad..b3f23e52 100644 --- a/openstackclient/tests/functional/object/v1/test_object.py +++ b/openstackclient/tests/functional/object/v1/test_object.py @@ -33,7 +33,7 @@ class ObjectTests(common.ObjectStoreTests): self.skipTest("No object-store service present") def test_object(self): - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(mode='w+') as f: f.write('test content') f.flush() self._test_object(f.name) |
