From 1353f2412b6de71d519bda6cd98513b082978281 Mon Sep 17 00:00:00 2001 From: Samuel Merritt Date: Wed, 23 Apr 2014 13:04:54 -0700 Subject: [PATCH] Fix up StringIO use in tests for py3 Some spots in this file were already referencing six.StringIO, but some were still using StringIO.StringIO, which does not work on py3. This patch just makes them all use six.StringIO and removes the now-unused (and wrong, on py3) import. Change-Id: I3c7311c3983f4eb409eedb6f85ede6ffe4059e63 --- tests/test_swiftclient.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py index 2a49114e..4e83a2d6 100644 --- a/tests/test_swiftclient.py +++ b/tests/test_swiftclient.py @@ -24,7 +24,6 @@ except ImportError: import six import socket import types -import StringIO import testtools import warnings from six.moves.urllib.parse import urlparse @@ -681,7 +680,7 @@ class TestPutObject(MockHttpTest): conn[1]._request = resp._fake_request astring = 'asdf' astring_len = len(astring) - mock_file = StringIO.StringIO(astring) + mock_file = six.StringIO(astring) c.put_object(url='http://www.test.com', http_conn=conn, contents=mock_file, content_length=astring_len) @@ -690,7 +689,7 @@ class TestPutObject(MockHttpTest): self.assertEqual(astring_len, len(resp.requests_params['data'].read())) - mock_file = StringIO.StringIO(astring) + mock_file = six.StringIO(astring) c.put_object(url='http://www.test.com', http_conn=conn, headers={'Content-Length': str(astring_len)}, contents=mock_file) @@ -707,7 +706,7 @@ class TestPutObject(MockHttpTest): conn[1]._request = resp._fake_request raw_data = 'asdf' * 256 chunk_size = 16 - mock_file = StringIO.StringIO(raw_data) + mock_file = six.StringIO(raw_data) c.put_object(url='http://www.test.com', http_conn=conn, contents=mock_file, chunk_size=chunk_size)