Remove six lib
Change-Id: If10f63674f2f7a4c0a38b7f76a2ba8ea86bab3ae
This commit is contained in:
parent
991e46c1c9
commit
874a778f55
@ -12,10 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
from http import client as http_client
|
||||
|
||||
|
||||
from cyborgclient.common import httpclient as http
|
||||
@ -34,7 +35,7 @@ def _get_error_body(faultstring=None, debuginfo=None):
|
||||
return raw_body
|
||||
|
||||
|
||||
HTTP_CLASS = six.moves.http_client.HTTPConnection
|
||||
HTTP_CLASS = http_client.HTTPConnection
|
||||
HTTPS_CLASS = http.VerifiedHTTPSConnection
|
||||
DEFAULT_TIMEOUT = 600
|
||||
|
||||
@ -64,7 +65,7 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
def test_server_exception_empty_body(self):
|
||||
error_body = _get_error_body()
|
||||
fake_resp = utils.FakeResponse({'content-type': 'application/json'},
|
||||
six.StringIO(error_body),
|
||||
io.StringIO(error_body),
|
||||
version=1,
|
||||
status=500)
|
||||
client = http.HTTPClient(
|
||||
@ -82,7 +83,7 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
error_msg = 'test error msg'
|
||||
error_body = _get_error_body(error_msg)
|
||||
fake_resp = utils.FakeResponse({'content-type': 'application/json'},
|
||||
six.StringIO(error_body),
|
||||
io.StringIO(error_body),
|
||||
version=1,
|
||||
status=500)
|
||||
client = http.HTTPClient(
|
||||
@ -102,7 +103,7 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
"File \\\"/usr/local/lib/python2.7/...")
|
||||
error_body = _get_error_body(error_msg, error_trace)
|
||||
fake_resp = utils.FakeResponse({'content-type': 'application/json'},
|
||||
six.StringIO(error_body),
|
||||
io.StringIO(error_body),
|
||||
version=1,
|
||||
status=500)
|
||||
client = http.HTTPClient(
|
||||
@ -227,7 +228,7 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
def test_401_unauthorized_exception(self):
|
||||
error_body = _get_error_body()
|
||||
fake_resp = utils.FakeResponse({'content-type': 'text/plain'},
|
||||
six.StringIO(error_body),
|
||||
io.StringIO(error_body),
|
||||
version=1,
|
||||
status=401)
|
||||
client = http.HTTPClient(
|
||||
|
@ -12,13 +12,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
from keystoneauth1 import fixture
|
||||
import six
|
||||
from testtools import matchers
|
||||
|
||||
from cyborgclient import exceptions
|
||||
@ -181,8 +181,8 @@ class ShellTest(utils.TestCase):
|
||||
self.fail('CommandError not raised')
|
||||
|
||||
@mock.patch('sys.argv', ['cyborg'])
|
||||
@mock.patch('sys.stdout', six.StringIO())
|
||||
@mock.patch('sys.stderr', six.StringIO())
|
||||
@mock.patch('sys.stdout', io.StringIO())
|
||||
@mock.patch('sys.stderr', io.StringIO())
|
||||
def test_main_noargs(self):
|
||||
# Ensure that main works with no command-line arguments
|
||||
try:
|
||||
|
@ -18,7 +18,7 @@ import os
|
||||
import sys
|
||||
|
||||
import fixtures
|
||||
import six
|
||||
import io
|
||||
import testtools
|
||||
|
||||
from cyborgclient.common import httpclient as http
|
||||
@ -49,7 +49,7 @@ class FakeAPI(object):
|
||||
|
||||
def raw_request(self, *args, **kwargs):
|
||||
response = self._request(*args, **kwargs)
|
||||
body_iter = http.ResponseBodyIterator(six.StringIO(response[1]))
|
||||
body_iter = http.ResponseBodyIterator(io.StringIO(response[1]))
|
||||
return FakeResponse(response[0]), body_iter
|
||||
|
||||
def json_request(self, *args, **kwargs):
|
||||
@ -142,8 +142,8 @@ class TestCase(testtools.TestCase):
|
||||
orig = sys.stdout
|
||||
orig_stderr = sys.stderr
|
||||
try:
|
||||
sys.stdout = six.StringIO()
|
||||
sys.stderr = six.StringIO()
|
||||
sys.stdout = io.StringIO()
|
||||
sys.stderr = io.StringIO()
|
||||
_shell = shell.OpenStackCyborgShell()
|
||||
_shell.main(argstr.split())
|
||||
except SystemExit:
|
||||
|
Loading…
Reference in New Issue
Block a user