tests: Remove Python 2.7 glue code from testlib

Remove the dependency on six in testlib.

Change-Id: I247088d119cf8f9d815632eae16a1cbf87930516
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39759
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Andreas Sandberg
2021-01-26 17:41:15 +00:00
parent 0d12b50e8e
commit 9f31b5c576
5 changed files with 4 additions and 13 deletions

View File

@@ -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, [])

View File

@@ -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

View File

@@ -67,7 +67,6 @@ a :class:`TestSuite` named after the module.
import os
import re
import six
import sys
import traceback

View File

@@ -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.

View File

@@ -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)