Remove usage of six
Remove six-library Replace the following items with Python 3 style code.
- six.StringIO
Change-Id: Ia8a28940edc9ca1b26ca0ef5112a44fe5fc6258d
diff --git a/tempest/lib/common/ssh.py b/tempest/lib/common/ssh.py
index 3a05f27..60107d7 100644
--- a/tempest/lib/common/ssh.py
+++ b/tempest/lib/common/ssh.py
@@ -14,6 +14,7 @@
# under the License.
+import io
import select
import socket
import time
@@ -67,7 +68,7 @@
self.password = password
if isinstance(pkey, six.string_types):
pkey = paramiko.RSAKey.from_private_key(
- six.StringIO(str(pkey)))
+ io.StringIO(str(pkey)))
self.pkey = pkey
self.look_for_keys = look_for_keys
self.key_filename = key_filename
diff --git a/tempest/tests/cmd/test_workspace.py b/tempest/tests/cmd/test_workspace.py
index eae6202..f16d533 100644
--- a/tempest/tests/cmd/test_workspace.py
+++ b/tempest/tests/cmd/test_workspace.py
@@ -12,15 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from io import StringIO
import os
import shutil
import subprocess
import tempfile
from unittest.mock import patch
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
from tempest.cmd import workspace
from tempest.lib.common.utils import data_utils
diff --git a/tempest/tests/lib/test_ssh.py b/tempest/tests/lib/test_ssh.py
index 85048fb..0ec9262 100644
--- a/tempest/tests/lib/test_ssh.py
+++ b/tempest/tests/lib/test_ssh.py
@@ -12,11 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from io import StringIO
import socket
from unittest import mock
import six
-from six import StringIO
import testtools
from tempest.lib.common import ssh
@@ -30,7 +30,7 @@
SELECT_POLLIN = 1
@mock.patch('paramiko.RSAKey.from_private_key')
- @mock.patch('six.StringIO')
+ @mock.patch('io.StringIO')
def test_pkey_calls_paramiko_RSAKey(self, cs_mock, rsa_mock):
cs_mock.return_value = mock.sentinel.csio
pkey = 'mykey'
diff --git a/tools/check_logs.py b/tools/check_logs.py
index 4b059f2..cc74b17 100755
--- a/tools/check_logs.py
+++ b/tools/check_logs.py
@@ -17,6 +17,7 @@
import argparse
import gzip
+import io
import os
import re
import sys
@@ -69,7 +70,7 @@
req = urlreq.Request(url)
req.add_header('Accept-Encoding', 'gzip')
page = urlreq.urlopen(req)
- buf = six.StringIO(page.read())
+ buf = io.StringIO(page.read())
f = gzip.GzipFile(fileobj=buf)
if scan_content(f.read().splitlines(), regexp, allow_list):
logs_with_errors.append(name)