summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_multithreading.py8
-rw-r--r--tests/test_swiftclient.py11
-rw-r--r--tests/test_utils.py4
3 files changed, 12 insertions, 11 deletions
diff --git a/tests/test_multithreading.py b/tests/test_multithreading.py
index c12f20c..b566837 100644
--- a/tests/test_multithreading.py
+++ b/tests/test_multithreading.py
@@ -18,8 +18,8 @@ import time
import mock
import testtools
import threading
-from cStringIO import StringIO
-from Queue import Queue, Empty
+import six
+from six.moves.queue import Queue, Empty
from swiftclient import multithreading as mt
from swiftclient.exceptions import ClientException
@@ -287,8 +287,8 @@ class TestMultiThreadingManager(ThreadTestCase):
], mock_qfq.call_args_list)
def test_printers(self):
- out_stream = StringIO()
- err_stream = StringIO()
+ out_stream = six.StringIO()
+ err_stream = six.StringIO()
with mt.MultiThreadingManager(
print_stream=out_stream,
diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py
index a31026e..21fec10 100644
--- a/tests/test_swiftclient.py
+++ b/tests/test_swiftclient.py
@@ -20,7 +20,8 @@ import six
import socket
import testtools
import warnings
-from urlparse import urlparse
+from six.moves.urllib.parse import urlparse
+from six.moves import reload_module
# TODO: mock http connection class with more control over headers
from .utils import fake_http_connect, fake_get_keystoneclient_2_0
@@ -62,14 +63,14 @@ class TestJsonImport(testtools.TestCase):
except ImportError:
pass
else:
- reload(json)
+ reload_module(json)
try:
import simplejson
except ImportError:
pass
else:
- reload(simplejson)
+ reload_module(simplejson)
super(TestJsonImport, self).tearDown()
def test_any(self):
@@ -84,7 +85,7 @@ class TestJsonImport(testtools.TestCase):
pass
else:
delattr(simplejson, 'loads')
- reload(c)
+ reload_module(c)
try:
from json import loads
@@ -137,7 +138,7 @@ class MockHttpTest(testtools.TestCase):
def tearDown(self):
super(MockHttpTest, self).tearDown()
- reload(c)
+ reload_module(c)
class MockHttpResponse():
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 4c4b29d..d9d74c5 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -15,7 +15,7 @@
import testtools
-from StringIO import StringIO
+import six
import tempfile
from swiftclient import utils as u
@@ -125,7 +125,7 @@ class TestPrtBytes(testtools.TestCase):
class TestLengthWrapper(testtools.TestCase):
def test_stringio(self):
- contents = StringIO('a' * 100)
+ contents = six.StringIO('a' * 100)
data = u.LengthWrapper(contents, 42)
self.assertEqual(42, len(data))
read_data = ''.join(iter(data.read, ''))