diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-06-03 12:21:47 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-06-03 12:21:47 +0000 |
commit | 24cd62db9b9a15b95bb7aedfad8d820210b9009f (patch) | |
tree | bc326ad16d56c0bdbad8273c49b3dffe572a1fb6 /tests | |
parent | e6b9e17d97834d2b192c497b2b2fd9c43670b68d (diff) | |
parent | 2bdad357fa19f05a3a579b47578f1510974eb0a4 (diff) | |
download | oslo-24cd62db9b9a15b95bb7aedfad8d820210b9009f.tar.gz oslo-24cd62db9b9a15b95bb7aedfad8d820210b9009f.tar.xz oslo-24cd62db9b9a15b95bb7aedfad8d820210b9009f.zip |
Merge "python3: python3 binary/text data compatbility"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/middleware/test_sizelimit.py | 10 | ||||
-rw-r--r-- | tests/unit/test_jsonutils.py | 5 | ||||
-rw-r--r-- | tests/unit/test_log.py | 4 | ||||
-rw-r--r-- | tests/unit/test_policy.py | 6 | ||||
-rw-r--r-- | tests/unit/test_processutils.py | 9 |
5 files changed, 18 insertions, 16 deletions
diff --git a/tests/unit/middleware/test_sizelimit.py b/tests/unit/middleware/test_sizelimit.py index 500f29d..22098d0 100644 --- a/tests/unit/middleware/test_sizelimit.py +++ b/tests/unit/middleware/test_sizelimit.py @@ -13,7 +13,7 @@ # under the License. from oslo.config import cfg -import StringIO +from six import StringIO import webob from openstack.common.middleware import sizelimit @@ -28,14 +28,14 @@ class TestLimitingReader(utils.BaseTestCase): def test_limiting_reader(self): BYTES = 1024 bytes_read = 0 - data = StringIO.StringIO("*" * BYTES) + data = StringIO("*" * BYTES) for chunk in sizelimit.LimitingReader(data, BYTES): bytes_read += len(chunk) self.assertEquals(bytes_read, BYTES) bytes_read = 0 - data = StringIO.StringIO("*" * BYTES) + data = StringIO("*" * BYTES) reader = sizelimit.LimitingReader(data, BYTES) byte = reader.read(1) while len(byte) != 0: @@ -49,7 +49,7 @@ class TestLimitingReader(utils.BaseTestCase): def _consume_all_iter(): bytes_read = 0 - data = StringIO.StringIO("*" * BYTES) + data = StringIO("*" * BYTES) for chunk in sizelimit.LimitingReader(data, BYTES - 1): bytes_read += len(chunk) @@ -58,7 +58,7 @@ class TestLimitingReader(utils.BaseTestCase): def _consume_all_read(): bytes_read = 0 - data = StringIO.StringIO("*" * BYTES) + data = StringIO("*" * BYTES) reader = sizelimit.LimitingReader(data, BYTES - 1) byte = reader.read(1) while len(byte) != 0: diff --git a/tests/unit/test_jsonutils.py b/tests/unit/test_jsonutils.py index 35a9487..758455b 100644 --- a/tests/unit/test_jsonutils.py +++ b/tests/unit/test_jsonutils.py @@ -16,9 +16,10 @@ # under the License. import datetime -import StringIO import xmlrpclib +from six import StringIO + from openstack.common import jsonutils from tests import utils @@ -32,7 +33,7 @@ class JSONUtilsTestCase(utils.BaseTestCase): self.assertEqual(jsonutils.loads('{"a": "b"}'), {'a': 'b'}) def test_load(self): - x = StringIO.StringIO('{"a": "b"}') + x = StringIO('{"a": "b"}') self.assertEqual(jsonutils.load(x), {'a': 'b'}) diff --git a/tests/unit/test_log.py b/tests/unit/test_log.py index 1641497..a65801b 100644 --- a/tests/unit/test_log.py +++ b/tests/unit/test_log.py @@ -1,11 +1,11 @@ import cStringIO import logging import os -import StringIO import sys import tempfile from oslo.config import cfg +from six import StringIO from openstack.common import context from openstack.common import jsonutils @@ -351,7 +351,7 @@ class SetDefaultsTestCase(test_utils.BaseTestCase): class LogConfigOptsTestCase(test_utils.BaseTestCase): def test_print_help(self): - f = StringIO.StringIO() + f = StringIO() CONF([]) CONF.print_help(file=f) self.assertTrue('debug' in f.getvalue()) diff --git a/tests/unit/test_policy.py b/tests/unit/test_policy.py index 582021b..cc96168 100644 --- a/tests/unit/test_policy.py +++ b/tests/unit/test_policy.py @@ -18,10 +18,10 @@ """Test of Policy Engine""" import os -import StringIO import urllib import mock +from six import StringIO import urllib2 from oslo.config import cfg @@ -779,7 +779,7 @@ class HttpCheckTestCase(PolicyBaseTestCase): return result @mock.patch.object(urllib2, 'urlopen', - return_value=StringIO.StringIO('True')) + return_value=StringIO('True')) def test_accept(self, mock_urlopen): check = policy.HttpCheck('http', '//example.com/%(name)s') @@ -798,7 +798,7 @@ class HttpCheckTestCase(PolicyBaseTestCase): )) @mock.patch.object(urllib2, 'urlopen', - return_value=StringIO.StringIO('other')) + return_value=StringIO('other')) def test_reject(self, mock_urlopen): check = policy.HttpCheck('http', '//example.com/%(name)s') diff --git a/tests/unit/test_processutils.py b/tests/unit/test_processutils.py index e00a66e..fbe9f34 100644 --- a/tests/unit/test_processutils.py +++ b/tests/unit/test_processutils.py @@ -19,9 +19,10 @@ from __future__ import print_function import fixtures import os -import StringIO import tempfile +from six import StringIO + from openstack.common import processutils from tests import utils @@ -213,7 +214,7 @@ class FakeSshChannel(object): return self.rc -class FakeSshStream(StringIO.StringIO): +class FakeSshStream(StringIO): def setup_channel(self, rc): self.channel = FakeSshChannel(rc) @@ -225,9 +226,9 @@ class FakeSshConnection(object): def exec_command(self, cmd): stdout = FakeSshStream('stdout') stdout.setup_channel(self.rc) - return (StringIO.StringIO(), + return (StringIO(), stdout, - StringIO.StringIO('stderr')) + StringIO('stderr')) class SshExecuteTestCase(utils.BaseTestCase): |