From: Andreas Sandberg Date: Tue, 26 Jan 2021 17:41:15 +0000 (+0000) Subject: tests: Remove Python 2.7 glue code from testlib X-Git-Tag: develop-gem5-snapshot~197 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9f31b5c576a496b05383c7cb33474d3f62a886c3;p=gem5.git tests: Remove Python 2.7 glue code from testlib Remove the dependency on six in testlib. Change-Id: I247088d119cf8f9d815632eae16a1cbf87930516 Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39759 Reviewed-by: Bobby R. Bruce Tested-by: kokoro --- diff --git a/ext/testlib/configuration.py b/ext/testlib/configuration.py index e5b75980d..f2d93d631 100644 --- a/ext/testlib/configuration.py +++ b/ext/testlib/configuration.py @@ -83,7 +83,6 @@ import copy import os import re -from six import add_metaclass from pickle import HIGHEST_PROTOCOL as highest_pickle_protocol from testlib.helper import absdirpath, AttrDict, FrozenAttrDict @@ -602,8 +601,7 @@ def define_common_args(config): # one in the list will be saved. common_args = AttrDict({arg.name:arg for arg in common_args}) -@add_metaclass(abc.ABCMeta) -class ArgParser(object): +class ArgParser(object, metaclass=abc.ABCMeta): class ExtendAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): items = getattr(namespace, self.dest, []) diff --git a/ext/testlib/handlers.py b/ext/testlib/handlers.py index 723a855e0..b62322f02 100644 --- a/ext/testlib/handlers.py +++ b/ext/testlib/handlers.py @@ -31,8 +31,6 @@ Handlers for the testlib Log. ''' -from __future__ import print_function - import multiprocessing import os import sys @@ -46,7 +44,7 @@ import testlib.result as result import testlib.state as state import testlib.terminal as terminal -from six.moves import queue as Queue +from queue import Queue from testlib.configuration import constants diff --git a/ext/testlib/loader.py b/ext/testlib/loader.py index 2d7699684..58b1b2e77 100644 --- a/ext/testlib/loader.py +++ b/ext/testlib/loader.py @@ -67,7 +67,6 @@ a :class:`TestSuite` named after the module. import os import re -import six import sys import traceback diff --git a/ext/testlib/log.py b/ext/testlib/log.py index 1bdb373b2..fb5907cd5 100644 --- a/ext/testlib/log.py +++ b/ext/testlib/log.py @@ -32,8 +32,6 @@ results and messages are reported through. ''' import testlib.wrappers as wrappers -from six import add_metaclass - class LogLevel(): Fatal = 0 Error = 1 @@ -56,8 +54,7 @@ class RecordTypeCounterMetaclass(type): RecordTypeCounterMetaclass.counter += 1 -@add_metaclass(RecordTypeCounterMetaclass) -class Record(object): +class Record(object, metaclass=RecordTypeCounterMetaclass): ''' A generic object that is passed to the :class:`Log` and its handlers. diff --git a/ext/testlib/terminal.py b/ext/testlib/terminal.py index bc4c85599..be489f529 100644 --- a/ext/testlib/terminal.py +++ b/ext/testlib/terminal.py @@ -28,7 +28,6 @@ import sys import fcntl import termios import struct -import six # Intended usage example: # @@ -85,7 +84,7 @@ class ColorStrings(object): def __init__(self, cap_string): for i, c in enumerate(color_names): setattr(self, c, cap_string('setaf', i)) - for name, cap in six.iteritems(capability_map): + for name, cap in capability_map.items(): setattr(self, name, cap_string(cap)) termcap = ColorStrings(cap_string)