From 33bcb9a5de0d544abb482e06fc363e57507924b2 Mon Sep 17 00:00:00 2001 From: Bryan Quigley Date: Wed, 8 Apr 2020 13:13:25 -0700 Subject: [global] Drop use of python six and other 2.X bits Resolves: #2006 Signed-off-by: Bryan Quigley --- tests/archive_tests.py | 5 +---- tests/plugin_tests.py | 9 ++------- tests/utilities_tests.py | 7 +++---- 3 files changed, 6 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/archive_tests.py b/tests/archive_tests.py index 8257997d..d890d12f 100644 --- a/tests/archive_tests.py +++ b/tests/archive_tests.py @@ -16,9 +16,6 @@ from sos.archive import TarFileArchive from sos.utilities import tail from sos.policies import Policy -# PYCOMPAT -import six - class TarFileArchiveTest(unittest.TestCase): @@ -56,7 +53,7 @@ class TarFileArchiveTest(unittest.TestCase): def test_add_string_from_file(self): self.copy_strings = [] testfile = tempfile.NamedTemporaryFile(dir=self.tmpdir, delete=False) - testfile.write(six.b("*" * 1000)) + testfile.write(b"*" * 1000) testfile.flush() testfile.close() diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index 207cb724..c88534d8 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -10,12 +10,7 @@ import os import tempfile import shutil -# PYCOMPAT -import six -try: - from StringIO import StringIO -except: - from io import StringIO +from io import StringIO from sos.report.plugins import Plugin, regex_findall, _mangle_command from sos.archive import TarFileArchive @@ -29,7 +24,7 @@ def j(filename): def create_file(size, dir=None): f = tempfile.NamedTemporaryFile(delete=False, dir=dir) - f.write(six.b("*" * size * 1024 * 1024)) + f.write(b"*" * size * 1024 * 1024) f.flush() f.close() return f.name diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py index 9d8df584..3513f42c 100644 --- a/tests/utilities_tests.py +++ b/tests/utilities_tests.py @@ -9,8 +9,7 @@ import os.path import unittest # PYCOMPAT -import six -from six import StringIO +from io import StringIO from sos.utilities import grep, is_executable, sos_get_command_output, find, tail, shell_out import sos @@ -42,12 +41,12 @@ class TailTest(unittest.TestCase): def test_tail(self): t = tail("tests/tail_test.txt", 10) - self.assertEquals(t, six.b("last line\n")) + self.assertEquals(t, b"last line\n") def test_tail_too_many(self): t = tail("tests/tail_test.txt", 200) expected = open("tests/tail_test.txt", "r").read() - self.assertEquals(t, six.b(expected)) + self.assertEquals(t, str.encode(expected)) class ExecutableTest(unittest.TestCase): -- cgit