Use six.StringIO instead of StringIO.StringIO
Keep Python 3.x compatibility Change-Id: If7a8f0630bd2582ca9488313dcc59805c2ce1835
This commit is contained in:
@@ -4,6 +4,7 @@ coverage>=3.6
|
|||||||
discover
|
discover
|
||||||
mock>=1.0
|
mock>=1.0
|
||||||
python-keystoneclient>=0.6.0
|
python-keystoneclient>=0.6.0
|
||||||
|
six>=1.5.2
|
||||||
sphinx>=1.1.2,<1.2
|
sphinx>=1.1.2,<1.2
|
||||||
testrepository>=0.0.18
|
testrepository>=0.0.18
|
||||||
testtools>=0.9.34
|
testtools>=0.9.34
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from StringIO import StringIO
|
from six import StringIO
|
||||||
import mock
|
import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
# TODO: More tests
|
# TODO: More tests
|
||||||
import mock
|
import mock
|
||||||
import logging
|
import logging
|
||||||
|
import six
|
||||||
import socket
|
import socket
|
||||||
import StringIO
|
|
||||||
import testtools
|
import testtools
|
||||||
import warnings
|
import warnings
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
@@ -576,7 +576,7 @@ class TestPutObject(MockHttpTest):
|
|||||||
|
|
||||||
def test_unicode_ok(self):
|
def test_unicode_ok(self):
|
||||||
conn = c.http_connection(u'http://www.test.com/')
|
conn = c.http_connection(u'http://www.test.com/')
|
||||||
mock_file = StringIO.StringIO(u'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91')
|
mock_file = six.StringIO(u'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91')
|
||||||
args = (u'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91',
|
args = (u'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91',
|
||||||
'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91',
|
'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91',
|
||||||
u'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91',
|
u'\u5929\u7a7a\u4e2d\u7684\u4e4c\u4e91',
|
||||||
@@ -596,7 +596,7 @@ class TestPutObject(MockHttpTest):
|
|||||||
|
|
||||||
def test_chunk_warning(self):
|
def test_chunk_warning(self):
|
||||||
conn = c.http_connection('http://www.test.com/')
|
conn = c.http_connection('http://www.test.com/')
|
||||||
mock_file = StringIO.StringIO('asdf')
|
mock_file = six.StringIO('asdf')
|
||||||
args = ('asdf', 'asdf', 'asdf', 'asdf', mock_file)
|
args = ('asdf', 'asdf', 'asdf', 'asdf', mock_file)
|
||||||
resp = MockHttpResponse()
|
resp = MockHttpResponse()
|
||||||
conn[1].getresponse = resp.fake_response
|
conn[1].getresponse = resp.fake_response
|
||||||
|
Reference in New Issue
Block a user