summaryrefslogtreecommitdiff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorYassine Lamgarchal <yassine.lamgarchal@enovance.com>2014-01-10 17:25:25 +0100
committerYassine Lamgarchal <yassine.lamgarchal@enovance.com>2014-01-10 17:25:45 +0100
commitae579aae093065222b0fb797a80e45fba978f995 (patch)
tree223279f88adc197a92aabe2e52f04b2a301493bc /tests/utils.py
parentc473f19fc97e8adff836f666760ebcaa85fa2010 (diff)
downloadpython-glanceclient-ae579aae093065222b0fb797a80e45fba978f995.tar.gz
Python3: use six.StringIO rather than StringIO.StringIO
It’s an alias for StringIO.StringIO in Python 2 and io.StringIO in Python 3. Change-Id: I5316eaffa2d9d2d5679b85a901933ef0fbfcc2f7
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 134968f..4739622 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -15,7 +15,7 @@
import copy
import requests
-import StringIO
+import six
import testtools
from glanceclient.common import http
@@ -33,7 +33,7 @@ class FakeAPI(object):
def raw_request(self, *args, **kwargs):
fixture = self._request(*args, **kwargs)
- resp = FakeResponse(fixture[0], StringIO.StringIO(fixture[1]))
+ resp = FakeResponse(fixture[0], six.StringIO(fixture[1]))
body_iter = http.ResponseBodyIterator(resp)
return resp, body_iter
@@ -98,7 +98,7 @@ class TestResponse(requests.Response):
return self._text
-class FakeTTYStdout(StringIO.StringIO):
+class FakeTTYStdout(six.StringIO):
"""A Fake stdout that try to emulate a TTY device as much as possible."""
def isatty(self):
@@ -109,7 +109,7 @@ class FakeTTYStdout(StringIO.StringIO):
if data.startswith('\r'):
self.seek(0)
data = data[1:]
- return StringIO.StringIO.write(self, data)
+ return six.StringIO.write(self, data)
class FakeNoTTYStdout(FakeTTYStdout):