diff options
186 files changed, 405 insertions, 1346 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8935a212e..f289cb1bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,20 +227,12 @@ IF(PIGLIT_BUILD_GLX_TESTS) ENDIF() if (NOT Python_ADDITIONAL_VERSIONS) - set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5 2.7) + set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6) endif() find_package(PythonInterp REQUIRED) find_package(PythonSix 1.5.2 REQUIRED) find_package(PythonNumpy 1.7.0 REQUIRED) - -# CMake doesn't have a VERSION_GREATER_EQUAL function, at least as of 3.0, -# And mako 1.0.2 contains bug fixes required for python 3.5 to work, so -# the only solution (short of having a series of "OR" statements, is this) -if (PYTHON_VERSION_STRING VERSION_GREATER 3.4.999999) - find_package(PythonMako 1.0.2 REQUIRED) -else () - find_package(PythonMako 0.8.0 REQUIRED) -endif (PYTHON_VERSION_STRING VERSION_GREATER 3.4.999999) +find_package(PythonMako 1.0.2 REQUIRED) find_package(bash-completion NO_MODULE) @@ -28,15 +28,13 @@ The original tests have been taken from First of all, you need to make sure that the following are installed: - - Python 2.7.x or >=3.5 + - Python >=3.6 - Python Mako module - numpy (http://www.numpy.org) - - six (https://pypi.python.org/pypi/six) - cmake (http://www.cmake.org) - GL, glu and glut libraries and development packages (i.e. headers) - X11 libraries and development packages (i.e. headers) - waffle (http://www.waffle-gl.org) - - mako Optionally, you can install the following: @@ -48,14 +46,6 @@ Optionally, you can install the following: - VkRunner. A shader script testing tool for Vulkan. (https://github.com/igalia/vkrunner) -For Python 2.x you can install the following to add features, these are -unnecessary for python3: - - backports.lzma. A backport of python3's lzma module to python2, - this enables fast native xz (de)compression in piglit for results files - (https://github.com/peterjc/backports.lzma) - - subprocess32. A backport of the subprocess from python3.2, which includes - timeout support. This only works for Linux - For testing the python framework using `py.test unittests/framework` - py.test. A python test framework, used for running the python framework test suite. diff --git a/framework/backends/__init__.py b/framework/backends/__init__.py index afcb4c2bb..07e1fab23 100644 --- a/framework/backends/__init__.py +++ b/framework/backends/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -42,14 +42,9 @@ that a user actually wants. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import importlib -import six - from .register import Registry from .compression import COMPRESSION_SUFFIXES @@ -165,7 +160,7 @@ def load(file_path): extension, compression = get_extension(file_path) - for backend in six.itervalues(BACKENDS): + for backend in BACKENDS.values(): if extension in backend.extensions: loader = backend.load diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py index 447dba17d..ae7b47e00 100644 --- a/framework/backends/abstract.py +++ b/framework/backends/abstract.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,17 +26,12 @@ This module provides mixins and base classes for backend modules. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import abc import contextlib import itertools import os import shutil -import six - from framework import options from . import compression from framework.results import TestResult @@ -66,8 +61,7 @@ def write_compressed(filename): yield f -@six.add_metaclass(abc.ABCMeta) -class Backend(object): +class Backend(metaclass=abc.ABCMeta): """ Abstract base class for summary backends This class provides an abstract ancestor for classes implementing backends, diff --git a/framework/backends/compression.py b/framework/backends/compression.py index 819b3ef9a..396a10ba8 100644 --- a/framework/backends/compression.py +++ b/framework/backends/compression.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -38,21 +38,17 @@ the best way to get a compressor. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import bz2 +import contextlib import errno import functools import gzip +import io +import lzma import os import subprocess -import contextlib - -import six -from six.moves import cStringIO as StringIO -from framework import exceptions, compat +from framework import exceptions from framework.core import PIGLIT_CONFIG __all__ = [ @@ -63,139 +59,33 @@ __all__ = [ ] -@compat.python_2_unicode_compatible class UnsupportedCompressor(exceptions.PiglitInternalError): def __init__(self, method, *args, **kwargs): super(UnsupportedCompressor, self).__init__(*args, **kwargs) self.__method = method def __str__(self): - return u'unsupported compression method {}'.format(self.__method) + return 'unsupported compression method {}'.format(self.__method) DEFAULT = 'bz2' -if six.PY2: - COMPRESSION_SUFFIXES = ['.gz', '.bz2'] - COMPRESSORS = { - 'bz2': functools.partial(bz2.BZ2File, mode='w'), - 'gz': functools.partial(gzip.open, mode='w'), - 'none': functools.partial(open, mode='w'), - } - - DECOMPRESSORS = { - 'bz2': functools.partial(bz2.BZ2File, mode='r'), - 'gz': functools.partial(gzip.open, mode='r'), - 'none': functools.partial(open, mode='r'), - } - - # First try to use backports.lzma, that's the easiest solution. If that - # fails then go to trying the shell. If that fails then piglit won't have - # xz support, and will raise an error if xz is used - try: - import backports.lzma # pylint: disable=wrong-import-position - - COMPRESSORS['xz'] = functools.partial(backports.lzma.open, mode='w') - DECOMPRESSORS['xz'] = functools.partial(backports.lzma.open, mode='r') - COMPRESSION_SUFFIXES += ['.xz'] - except ImportError: - try: - with open(os.devnull, 'w') as d: - subprocess.check_call(['xz', '--help'], stdout=d, stderr=d) - except OSError: - pass - else: - - @contextlib.contextmanager - def _compress_xz(filename): - """Emulates an open function in write mode for xz. - - Python 2.x doesn't support xz, but it's dang useful. This - function calls out to the shell and tries to use xz from the - environment to get xz compression. - - This obviously won't work without a working xz binary. - - This function tries to emulate the default values of the lzma - module in python3 as much as possible - - """ - if filename.endswith('.xz'): - filename = filename[:-3] - - with open(filename, 'w') as f: - yield f - - try: - with open(os.devnull, 'w') as null: - subprocess.check_call( - ['xz', '--compress', '-9', '--force', filename], - stderr=null) - except OSError as e: - if e.errno == errno.ENOENT: - raise exceptions.PiglitFatalError( - 'No xz binary available') - raise - - @contextlib.contextmanager - def _decompress_xz(filename): - """Eumlates an option function in read mode for xz. - - See the comment in _compress_xz for more information. - - This function tries to emulate the lzma module as much as - possible - - """ - if not filename.endswith('.xz'): - filename = '{}.xz'.format(filename) - - try: - with open(os.devnull, 'w') as null: - string = subprocess.check_output( - ['xz', '--decompress', '--stdout', filename], - stderr=null) - except OSError as e: - if e.errno == errno.ENOENT: - raise exceptions.PiglitFatalError( - 'No xz binary available') - raise - - # We need a file-like object, so the contents must be placed in - # a StringIO object. - io = StringIO() - io.write(string) - io.seek(0) - - yield io - - io.close() - - COMPRESSORS['xz'] = _compress_xz - DECOMPRESSORS['xz'] = _decompress_xz - COMPRESSION_SUFFIXES += ['.xz'] -else: - # In the case of python 3 this all just works, no monkeying around with - # imports and fallbacks. just import the right modules and go - - import lzma # pylint: disable=wrong-import-position,wrong-import-order - - COMPRESSION_SUFFIXES = ['.gz', '.bz2', '.xz'] - - COMPRESSORS = { - 'bz2': functools.partial(bz2.open, mode='wt'), - 'gz': functools.partial(gzip.open, mode='wt'), - 'none': functools.partial(open, mode='w'), - 'xz': functools.partial(lzma.open, mode='wt'), - } - - DECOMPRESSORS = { - 'bz2': functools.partial(bz2.open, mode='rt'), - 'gz': functools.partial(gzip.open, mode='rt'), - 'none': functools.partial(open, mode='r'), - 'xz': functools.partial(lzma.open, mode='rt'), - } +COMPRESSION_SUFFIXES = ['.gz', '.bz2', '.xz'] + +COMPRESSORS = { + 'bz2': functools.partial(bz2.open, mode='wt'), + 'gz': functools.partial(gzip.open, mode='wt'), + 'none': functools.partial(open, mode='w'), + 'xz': functools.partial(lzma.open, mode='wt'), +} + +DECOMPRESSORS = { + 'bz2': functools.partial(bz2.open, mode='rt'), + 'gz': functools.partial(gzip.open, mode='rt'), + 'none': functools.partial(open, mode='r'), + 'xz': functools.partial(lzma.open, mode='rt'), +} def get_mode(): diff --git a/framework/backends/json.py b/framework/backends/json.py index 556621e5f..de69f35cc 100644 --- a/framework/backends/json.py +++ b/framework/backends/json.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016-2017 Intel Corporation +# Copyright (c) 2014, 2016-2017, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """ Module providing json backend for piglit """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections import functools import os @@ -36,14 +33,13 @@ try: except ImportError: import json -import six try: import jsonstreams _STREAMS = True except ImportError: _STREAMS = False -from framework import status, results, exceptions, compat +from framework import status, results, exceptions from .abstract import FileBackend, write_compressed from .register import Registry from . import compression @@ -70,7 +66,7 @@ def piglit_encoder(obj): """ if isinstance(obj, status.Status): - return six.text_type(obj) + return str(obj) elif isinstance(obj, set): return list(obj) elif hasattr(obj, 'to_json'): @@ -182,10 +178,10 @@ class JSONBackend(FileBackend): s.write('__type__', 'TestrunResult') with open(os.path.join(self._dest, 'metadata.json'), 'r') as n: - s.iterwrite(six.iteritems(json.load(n, object_pairs_hook=collections.OrderedDict))) + s.iterwrite(json.load(n, object_pairs_hook=collections.OrderedDict).items()) if metadata: - s.iterwrite(six.iteritems(metadata)) + s.iterwrite(metadata.items()) with s.subobject('tests') as t: for test in file_list: @@ -197,7 +193,7 @@ class JSONBackend(FileBackend): except ValueError: continue - t.iterwrite(six.iteritems(a)) + t.iterwrite(a.items()) # Delete the temporary files @@ -267,7 +263,7 @@ def _load(results_file): raise exceptions.PiglitFatalError( 'While loading json results file: "{}",\n' 'the following error occurred:\n{}'.format(results_file.name, - six.text_type(e))) + str(e))) return result @@ -371,7 +367,7 @@ def _update_seven_to_eight(result): This value is used for both TestResult.time and TestrunResult.time_elapsed. """ - for test in compat.viewvalues(result['tests']): + for test in result['tests'].values(): test['time'] = {'start': 0.0, 'end': float(test['time']), '__type__': 'TimeAttribute'} @@ -391,7 +387,7 @@ def _update_eight_to_nine(result): null rather than a single integer or null. """ - for test in compat.viewvalues(result['tests']): + for test in result['tests'].values(): if 'pid' in test: test['pid'] = [test['pid']] else: diff --git a/framework/backends/junit.py b/framework/backends/junit.py index 349e06db7..331e80edf 100644 --- a/framework/backends/junit.py +++ b/framework/backends/junit.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """ Module implementing a JUnitBackend for piglit """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os.path import shutil try: @@ -35,8 +32,6 @@ try: except ImportError: import json -import six - from framework import grouptools, results, exceptions from framework.core import PIGLIT_CONFIG from .abstract import FileBackend @@ -146,7 +141,7 @@ class JUnitWriter(object): # Add the piglit type to the failure result if res is not None: - res.attrib['type'] = six.text_type(result) + res.attrib['type'] = str(result) def _make_root(self, testname, classname, data): """Creates and returns the root element.""" @@ -202,7 +197,7 @@ class JUnitWriter(object): self._make_result(element, data.result, expected_result) - f.write(six.text_type(etree.tostring(element).decode('utf-8'))) + f.write(str(etree.tostring(element).decode('utf-8'))) class JUnitSubtestWriter(JUnitWriter): @@ -220,13 +215,13 @@ class JUnitSubtestWriter(JUnitWriter): element = etree.Element('testsuite', name=testname, time=str(data.time.total), - tests=six.text_type(len(data.subtests))) - for test, result in six.iteritems(data.subtests): + tests=str(len(data.subtests))) + for test, result in data.subtests.items(): etree.SubElement(element, 'testcase', name=self._make_full_test_name(test), classname=testname, - status=six.text_type(result)) + status=str(result)) else: element = super(JUnitSubtestWriter, self)._make_root( @@ -249,7 +244,7 @@ class JUnitSubtestWriter(JUnitWriter): out.text = data.command + '\n' + out.text if data.subtests: - for subname, result in six.iteritems(data.subtests): + for subname, result in data.subtests.items(): # replace special characters and make case insensitive elem = element.find('.//testcase[@name="{}"]'.format( self._make_full_test_name(subname))) @@ -267,7 +262,7 @@ class JUnitSubtestWriter(JUnitWriter): self._expected_result('{}.{}'.format( classname, testname).lower())) - f.write(six.text_type(etree.tostring(element).decode('utf-8'))) + f.write(str(etree.tostring(element).decode('utf-8'))) class JUnitBackend(FileBackend): diff --git a/framework/backends/register.py b/framework/backends/register.py index 2e874fed2..32aed17ab 100644 --- a/framework/backends/register.py +++ b/framework/backends/register.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """An object for registering backends.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections Registry = collections.namedtuple( diff --git a/framework/compat.py b/framework/compat.py deleted file mode 100644 index 85030b8e6..000000000 --- a/framework/compat.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding=utf-8 -# Copyright (c) 2016 Intel Corporation - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -"""A small library that contains libraries equivalent to six - -This function is pending upstreaming in six. - -""" - -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - -import six - -def python_2_bool_compatible(class_): - """A decorator to fix __bool__/__nonzero__ name changes.""" - if six.PY2: - try: - class_.__nonzero__ = class_.__bool__ - except AttributeError: - raise ValueError( - "@python_2_bool_compatible cannot be applied to {} because " - "it doesn't define __bool__().".format(class_.__name__)) - return class_ - - -# Some version of six don't have this function -try: - from six import python_2_unicode_compatible -except ImportError: - def python_2_unicode_compatible(class_): - """A decorator to fix __str/__bytes__/__unicode__ name changes.""" - if six.PY2: - failed = False - try: - class_.__unicode__ = class_.__str__ - except AttributeError: - failed = True - - try: - class_.__str__ = class_.__bytes__ - except AttributeError: - if failed: - raise ValueError( - "@python_2_unicode_compatible cannot be applied to {} " - "because it doesn't define __str__() " - "or __bytes__().".format(class_.__name__)) - return class_ - - -try: - from six import viewvalues -except ImportError: - if six.PY2: - viewvalues = lambda d: d.viewvalues() - elif six.PY3: - viewvalues = lambda d: d.values() diff --git a/framework/core.py b/framework/core.py index 46912955c..f284beea9 100644 --- a/framework/core.py +++ b/framework/core.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,15 +26,11 @@ historically reasons is called "core" in piglit. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) +import configparser import errno import os import subprocess -from six.moves import configparser - from framework import exceptions __all__ = [ diff --git a/framework/dmesg.py b/framework/dmesg.py index a70983570..5112f9bef 100644 --- a/framework/dmesg.py +++ b/framework/dmesg.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2013-2016 Intel Corporation +# Copyright (c) 2013-2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -36,9 +36,6 @@ dmesg implementation for their OS. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import abc import gzip import re @@ -46,8 +43,6 @@ import subprocess import sys import warnings -import six - from framework import exceptions __all__ = [ @@ -58,8 +53,7 @@ __all__ = [ ] -@six.add_metaclass(abc.ABCMeta) -class BaseDmesg(object): +class BaseDmesg(metaclass=abc.ABCMeta): """ Abstract base class for Dmesg derived objects This provides the bases of the constructor, and most subclasses should call @@ -144,7 +138,7 @@ class BaseDmesg(object): result.result = replace(result.result) # Replace the results of any subtests - for key, value in six.iteritems(result.subtests): + for key, value in result.subtests.items(): result.subtests[key] = replace(value) # Add the dmesg values to the result diff --git a/framework/driver_classifier.py b/framework/driver_classifier.py index c36b35396..3f8b7c14c 100644 --- a/framework/driver_classifier.py +++ b/framework/driver_classifier.py @@ -1,4 +1,5 @@ # coding=utf-8 +# Copyright © 2019 Intel Corporation # Copyright (c) 2016 Broadcom # # Permission is hereby granted, free of charge, to any person obtaining a @@ -20,9 +21,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import errno import re import subprocess diff --git a/framework/exceptions.py b/framework/exceptions.py index 5ea47c6a1..2f2e89247 100644 --- a/framework/exceptions.py +++ b/framework/exceptions.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,12 +21,9 @@ """Exception and error classes for piglit, and exception handlers.""" -from __future__ import print_function, absolute_import, division import sys import functools -from framework import compat - __all__ = [ 'PiglitInternalError', 'PiglitFatalError', @@ -64,7 +61,6 @@ def handler(func): return _inner -@compat.python_2_unicode_compatible class PiglitException(Exception): """Class for non-error exceptions. @@ -73,11 +69,10 @@ class PiglitException(Exception): """ def __str__(self): - return (u'An internal exception that should have been handled was not:' + return ('An internal exception that should have been handled was not:' '\n{}'.format(super(PiglitException, self).__str__())) -@compat.python_2_unicode_compatible class PiglitInternalError(Exception): """Class for errors in piglit. @@ -85,7 +80,7 @@ class PiglitInternalError(Exception): """ def __str__(self): - return u'An internal error occurred:\n{}'.format( + return 'An internal error occurred:\n{}'.format( super(PiglitInternalError, self).__str__()) diff --git a/framework/grouptools.py b/framework/grouptools.py index 11b0af95a..961d59738 100644 --- a/framework/grouptools.py +++ b/framework/grouptools.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -30,13 +30,6 @@ posix paths they may not start with a leading '/'. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - -import six -from six.moves import zip - __all__ = [ 'SEPARATOR', 'commonprefix', @@ -162,7 +155,7 @@ def from_path(path): This safely handles both Windows and Unix style paths. """ - assert isinstance(path, six.string_types), 'Type must be string or unicode' + assert isinstance(path, str), 'Type must be str' if '\\' in path: path = path.replace('\\', SEPARATOR) @@ -184,5 +177,5 @@ def format(name): want to see. """ - assert isinstance(name, six.string_types) + assert isinstance(name, str) return name.replace(SEPARATOR, '/') diff --git a/framework/log.py b/framework/log.py index 69e89bf7d..f99e82208 100644 --- a/framework/log.py +++ b/framework/log.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2013-2016 Intel Corporation +# Copyright (c) 2013-2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -27,30 +27,25 @@ returning BaseLog derived instances to individual tests. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import sys import abc import itertools import threading import collections +from http.server import HTTPServer, BaseHTTPRequestHandler + try: import simplejson as json except ImportError: import json -import six -from six.moves.BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler - from framework.core import PIGLIT_CONFIG from framework import grouptools __all__ = ['LogManager'] -@six.add_metaclass(abc.ABCMeta) -class BaseLog(object): +class BaseLog(metaclass=abc.ABCMeta): """ Abstract base class for Log objects It provides a lock, which should be used to lock whever the shared state is @@ -170,7 +165,7 @@ class QuietLog(BaseLog): done=str(self._state['complete']).zfill(self._pad), total=str(self._state['total']).zfill(self._pad), status=', '.join('{0}: {1}'.format(k, v) for k, v in - sorted(six.iteritems(self._state['summary']))), + sorted(self._state['summary'].items())), running=''.join('|/-\\'[x % 4] for x in self._state['running']) ) diff --git a/framework/monitoring.py b/framework/monitoring.py index 1eb213c3c..1ee557577 100644 --- a/framework/monitoring.py +++ b/framework/monitoring.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2016 Intel Corporation +# Copyright (c) 2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -32,16 +32,11 @@ with code 3. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import abc import errno import os import re -import six - from framework.core import PIGLIT_CONFIG from framework.dmesg import LinuxDmesg from framework import exceptions @@ -138,7 +133,7 @@ class Monitoring(object): def update_monitoring(self): """Update the new messages for each monitoring object""" if self._monitoring_rules: - for monitoring_rule in six.itervalues(self._monitoring_rules): + for monitoring_rule in self._monitoring_rules.values(): monitoring_rule.update_monitoring() def check_monitoring(self): @@ -153,8 +148,7 @@ class Monitoring(object): self.update_monitoring() if self._monitoring_rules: - for rule_key, monitoring_rule in six.iteritems( - self._monitoring_rules): + for rule_key, monitoring_rule in self._monitoring_rules.items(): # Get error message self._abort_error = monitoring_rule.check_monitoring() # if error message is not empty, abort is requested @@ -165,8 +159,7 @@ class Monitoring(object): break -@six.add_metaclass(abc.ABCMeta) -class BaseMonitoring(object): +class BaseMonitoring(metaclass=abc.ABCMeta): """Abstract base class for Monitoring derived objects This provides the bases of the constructor and most subclasses should call diff --git a/framework/options.py b/framework/options.py index 0abe1f63d..d6ad42a7b 100644 --- a/framework/options.py +++ b/framework/options.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,13 +26,8 @@ is that while you can mutate """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os -import six - __all__ = ['OPTIONS'] # pylint: disable=too-few-public-methods @@ -78,7 +73,7 @@ class _Options(object): # pylint: disable=too-many-instance-attributes self.__init__() def __iter__(self): - for key, values in six.iteritems(self.__dict__): + for key, values in self.__dict__.items(): if not key.startswith('_'): yield key, values diff --git a/framework/profile.py b/framework/profile.py index 1a0a91c24..8736ae792 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -28,9 +28,6 @@ that you have a group of tests you want to run, here are the names of those tests, and the Test instance. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import ast import collections import contextlib @@ -44,8 +41,6 @@ import os import re import xml.etree.cElementTree as et -import six - from framework import grouptools, exceptions, status from framework.dmesg import get_dmesg from framework.log import LogManager @@ -134,7 +129,7 @@ class TestDict(collections.MutableMapping): file-systems. """ # keys should be strings - if not isinstance(key, six.text_type): + if not isinstance(key, str): raise exceptions.PiglitFatalError( "TestDict keys must be strings, but was {}".format(type(key))) @@ -214,7 +209,7 @@ class TestDict(collections.MutableMapping): ... g(['test']) ... g(['power', 'test'], 'powertest') """ - assert isinstance(group, six.string_types), type(group) + assert isinstance(group, str), type(group) def adder(args, name=None, override_class=None, **kwargs): """Helper function that actually adds the tests. @@ -236,15 +231,14 @@ class TestDict(collections.MutableMapping): assert isinstance(args, list) # // name = ' '.join(args) - assert isinstance(name, six.string_types) + assert isinstance(name, str) lgroup = grouptools.join(group, name) class_ = override_class or test_class self[lgroup] = class_( args, - **dict(itertools.chain(six.iteritems(default_args), - six.iteritems(kwargs)))) + **dict(itertools.chain(default_args.items(), kwargs.items()))) yield adder @@ -397,7 +391,7 @@ class XMLProfile(object): opts[n] = DummyTest(n, status.NOTRUN) else: opts[n] = alltests[n] - return six.iteritems(opts) + return opt.items() else: return iter(self._itertests()) @@ -456,7 +450,7 @@ class MetaProfile(object): opts[n] = DummyTest(n, status.NOTRUN) else: opts[n] = alltests[n] - return six.iteritems(opts) + return opts.items() else: return iter(self._itertests()) @@ -529,7 +523,7 @@ class TestProfile(object): else: opts = self.test_list # pylint: disable=redefined-variable-type - for k, v in self.filters.run(six.iteritems(opts)): + for k, v in self.filters.run(opts.items()): yield k, v diff --git a/framework/programs/parsers.py b/framework/programs/parsers.py index 242d9c4a9..0287f97e0 100644 --- a/framework/programs/parsers.py +++ b/framework/programs/parsers.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/framework/programs/print_commands.py b/framework/programs/print_commands.py index 5daaf7756..cf7087c7f 100644 --- a/framework/programs/print_commands.py +++ b/framework/programs/print_commands.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2016 Intel Corporation +# Copyright (c) 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,15 +26,10 @@ or to create lists of tests to be consumed via "piglit run --test-list" """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import argparse import os import sys -import six - from . import parsers from framework import options, profile, exceptions from framework.test import Test diff --git a/framework/programs/run.py b/framework/programs/run.py index d0a3fcfe9..ee4d54476 100644 --- a/framework/programs/run.py +++ b/framework/programs/run.py @@ -20,9 +20,6 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import argparse import ctypes import os @@ -32,8 +29,6 @@ import shutil import sys import time -import six - from framework import core, backends, options from framework import dmesg from framework import exceptions @@ -455,7 +450,7 @@ def resume(input_): # Don't re-run tests that have already completed, incomplete status tests # have obviously not completed. exclude_tests = set() - for name, result in six.iteritems(results.tests): + for name, result in results.tests.items(): if args.no_retry or result.result != 'incomplete': exclude_tests.add(name) diff --git a/framework/programs/summary.py b/framework/programs/summary.py index 81a2eb72c..3a6e4f3c2 100644 --- a/framework/programs/summary.py +++ b/framework/programs/summary.py @@ -20,9 +20,6 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import argparse import shutil import os @@ -30,8 +27,6 @@ import os.path as path import sys import errno -import six - from framework import summary, status, core, backends, exceptions from . import parsers @@ -221,7 +216,7 @@ def formatted(input_, default_format_string=DEFAULT_FMT_STR): testrun = backends.load(args.test_results) def write_results(output): - for name, result in six.iteritems(testrun.tests): + for name, result in testrun.tests.items(): if result.result in args.exclude_details: continue output.write((args.format_string + "\n").format( diff --git a/framework/results.py b/framework/results.py index 214971735..970ea24eb 100644 --- a/framework/results.py +++ b/framework/results.py @@ -22,16 +22,11 @@ """ Module for results generation """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections import copy import datetime -import six - -from framework import status, exceptions, grouptools, compat +from framework import status, exceptions, grouptools __all__ = [ 'TestrunResult', @@ -87,8 +82,8 @@ class StringDescriptor(object): # pylint: disable=too-few-public-methods returns a unicode object. """ - def __init__(self, name, default=six.text_type()): - assert isinstance(default, six.text_type) + def __init__(self, name, default=''): + assert isinstance(default, str) self.__name = name self.__default = default @@ -96,9 +91,9 @@ class StringDescriptor(object): # pylint: disable=too-few-public-methods return getattr(instance, self.__name, self.__default) def __set__(self, instance, value): - if isinstance(value, six.binary_type): + if isinstance(value, bytes): setattr(instance, self.__name, value.decode('utf-8', 'replace')) - elif isinstance(value, six.text_type): + elif isinstance(value, str): setattr(instance, self.__name, value) else: raise TypeError('{} attribute must be a unicode or bytes instance, ' @@ -181,7 +176,7 @@ class TestResult(object): """ if self.subtests and self.__result != status.CRASH: - return max(six.itervalues(self.subtests)) + return max(self.subtests.values()) return self.__result @property @@ -263,12 +258,11 @@ class TestResult(object): self.subtests.update(dict_['subtest']) -@compat.python_2_bool_compatible class Totals(dict): def __init__(self, *args, **kwargs): super(Totals, self).__init__(*args, **kwargs) for each in status.ALL: - each = six.text_type(each) + each = str(each) if each not in self: self[each] = 0 @@ -276,7 +270,7 @@ class Totals(dict): # Since totals are prepopulated, calling 'if not <Totals instance>' # will always result in True, this will cause it to return True only if # one of the values is not zero - for each in six.itervalues(self): + for each in self.values(): if each != 0: return True return False @@ -327,11 +321,11 @@ class TestrunResult(object): def calculate_group_totals(self): """Calculate the number of passes, fails, etc at each level.""" - for name, result in six.iteritems(self.tests): + for name, result in self.tests.items(): # If there are subtests treat the test as if it is a group instead # of a test. if result.subtests: - for res in six.itervalues(result.subtests): + for res in result.subtests.values(): res = str(res) temp = name @@ -352,7 +346,7 @@ class TestrunResult(object): self.calculate_group_totals() rep = copy.copy(self.__dict__) rep['tests'] = collections.OrderedDict((k, t.to_json()) - for k, t in six.iteritems(self.tests)) + for k, t in self.tests.items()) rep['__type__'] = 'TestrunResult' return rep @@ -380,12 +374,12 @@ class TestrunResult(object): setattr(res, 'time_elapsed', TimeAttribute.from_dict(dict_['time_elapsed'])) res.tests = collections.OrderedDict((n, TestResult.from_dict(t)) - for n, t in six.iteritems(dict_['tests'])) + for n, t in dict_['tests'].items()) if not 'totals' in dict_ and not _no_totals: res.calculate_group_totals() else: res.totals = {n: Totals.from_dict(t) for n, t in - six.iteritems(dict_['totals'])} + dict_['totals'].items()} return res diff --git a/framework/status.py b/framework/status.py index 14f058804..991a8e0d8 100644 --- a/framework/status.py +++ b/framework/status.py @@ -57,13 +57,7 @@ The formula for determining fixes is: """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - -import six - -from framework import exceptions, compat +from framework import exceptions __all__ = ['NOTRUN', 'PASS', @@ -98,7 +92,6 @@ def status_lookup(status): raise StatusException(status) -@compat.python_2_unicode_compatible class StatusException(exceptions.PiglitInternalError): """ Raise this exception when a string is passed to status_lookup that doesn't exists @@ -117,7 +110,6 @@ class StatusException(exceptions.PiglitInternalError): return u'Unknown status "{}"'.format(self.__status) -@compat.python_2_unicode_compatible class Status(object): """ A simple class for representing the output values of tests. @@ -146,7 +138,7 @@ class Status(object): assert isinstance(value, int), type(value) # The object is immutable, so calling self.foo = foo will raise a # TypeError. Using setattr from the parrent object works around this. - self.__name = six.text_type(name) + self.__name = str(name) self.__value = value self.__fraction = fraction @@ -170,10 +162,7 @@ class Status(object): self.name, self.value, self.fraction) def __bytes__(self): - if six.PY2: - return str(self.name) - elif six.PY3: - return bytes(self.name, 'utf-8') + return bytes(self.name, 'utf-8') def __str__(self): return self.name @@ -189,10 +178,10 @@ class Status(object): # the __int__ magic method if isinstance(other, (int, Status)): return int(self) == int(other) - elif isinstance(other, six.text_type): - return six.text_type(self) == other - elif isinstance(other, six.binary_type): - return six.binary_type(self) == other + elif isinstance(other, str): + return str(self) == other + elif isinstance(other, bytes): + return bytes(self) == other raise TypeError("Cannot compare type: {}".format(type(other))) def __ne__(self, other): @@ -223,13 +212,13 @@ class NoChangeStatus(Status): super(NoChangeStatus, self).__init__(name, value, fraction) def __eq__(self, other): - if isinstance(other, (str, six.text_type, Status)): - return six.text_type(self) == six.text_type(other) + if isinstance(other, (str, Status)): + return str(self) == str(other) raise TypeError("Cannot compare type: {}".format(type(other))) def __ne__(self, other): - if isinstance(other, (str, six.text_type, Status)): - return six.text_type(self) != six.text_type(other) + if isinstance(other, (str, Status)): + return str(self) != str(other) raise TypeError("Cannot compare type: {}".format(type(other))) def __hash__(self): diff --git a/framework/summary/common.py b/framework/summary/common.py index f62dcedf0..2dfce5e62 100644 --- a/framework/summary/common.py +++ b/framework/summary/common.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2013-2016 Intel Corporation +# Copyright 2013-2016, 2019 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices # Copyright 2014 VMWare @@ -23,15 +23,9 @@ """Shared functions for summary generation.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import re import operator -import six -from six.moves import zip - # a local variable status exists, prevent accidental overloading by renaming # the module import framework.status as so @@ -96,11 +90,11 @@ class Names(object): """A set of all tests in all runs.""" all_ = set() for res in self.__results: - for key, value in six.iteritems(res.tests): + for key, value in res.tests.items(): if not value.subtests: all_.add(key) else: - for subt in six.iterkeys(value.subtests): + for subt in value.subtests.keys(): all_.add(grouptools.join(key, subt)) return all_ diff --git a/framework/summary/console_.py b/framework/summary/console_.py index f789bdef6..287e52a45 100644 --- a/framework/summary/console_.py +++ b/framework/summary/console_.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2013-2016 Intel Corporation +# Copyright 2013-2016, 2019 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices # Copyright 2014 VMWare @@ -23,12 +23,8 @@ """Generate text summaries to be printed to the console.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import textwrap import time -import six from framework import grouptools, backends from .common import Results @@ -92,7 +88,7 @@ def _print_summary(results): regressions=print_template.format( *[str(s) for s in results.counts.regressions]), total=print_template.format(*[ - str(sum(six.itervalues(x.totals['root']))) + str(sum(x.totals['root'].values())) for x in results.results]), time=print_template.format( *[elapsed_time(r.time_elapsed) for r in results.results]), diff --git a/framework/summary/feature.py b/framework/summary/feature.py index 873ff10fc..bdf13752a 100644 --- a/framework/summary/feature.py +++ b/framework/summary/feature.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2016-2016 Intel Corporation +# Copyright (c) 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -22,10 +22,6 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - try: import simplejson as json except ImportError: diff --git a/framework/summary/html_.py b/framework/summary/html_.py index 19d4dd5cd..cd85363e8 100644 --- a/framework/summary/html_.py +++ b/framework/summary/html_.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2013-2016 Intel Corporation +# Copyright 2013-2016, 2019 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices # Copyright 2014 VMWare @@ -23,9 +23,6 @@ """Genrate html summaries.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import errno import getpass import os @@ -38,7 +35,6 @@ import zlib import mako from mako.lookup import TemplateLookup -import six # a local variable status exists, prevent accidental overloading by renaming # the module @@ -113,7 +109,7 @@ def _make_testrun_info(results, destination, exclude=None): info=each.info)) # Then build the individual test results - for key, value in six.iteritems(each.tests): + for key, value in each.tests.items(): html_path = os.path.join(destination, name, escape_filename(key + ".html")) temp_path = os.path.dirname(html_path) diff --git a/framework/test/__init__.py b/framework/test/__init__.py index daf3b6d41..1d14cb01e 100644 --- a/framework/test/__init__.py +++ b/framework/test/__init__.py @@ -25,9 +25,6 @@ # create a general use API, but allow it to be controlled by setting the # __all__ in each module -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) from .base import * from .piglit_test import * from .glsl_parser_test import * diff --git a/framework/test/base.py b/framework/test/base.py index 6e719cc78..77f07c211 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -23,85 +23,45 @@ """ Module provides a base class for Tests """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) +import abc +import copy import errno +import itertools import os -import time +import signal +import subprocess import sys +import time import traceback -import itertools -import abc -import copy -import signal import warnings -import six -from six.moves import range - from framework import exceptions from framework import status from framework.options import OPTIONS from framework.results import TestResult -# We're doing some special crazy here to make timeouts work on python 2. pylint -# is going to complain a lot -# pylint: disable=wrong-import-position,wrong-import-order -if six.PY2: - try: - # subprocess32 only supports *nix systems, this is important because - # "start_new_session" is not a valid argument on windows - - import subprocess32 as subprocess - _EXTRA_POPEN_ARGS = {'start_new_session': True} - except ImportError: - # If there is no timeout support, fake it. Add a TimeoutExpired - # exception and a Popen that accepts a timeout parameter (and ignores - # it), then shadow the actual Popen with this wrapper. - - import subprocess - - class TimeoutExpired(Exception): - pass - - class Popen(subprocess.Popen): - """Sublcass of Popen that accepts and ignores a timeout argument.""" - def communicate(self, *args, **kwargs): - if 'timeout' in kwargs: - del kwargs['timeout'] - return super(Popen, self).communicate(*args, **kwargs) - - subprocess.TimeoutExpired = TimeoutExpired - subprocess.Popen = Popen - _EXTRA_POPEN_ARGS = {} - - warnings.warn('Timeouts are not available') -elif six.PY3: - # In python3.2+ this all just works, no need for the madness above. - import subprocess - _EXTRA_POPEN_ARGS = {} - - if sys.platform == 'win32': - # There is no implementation in piglit to make timeouts work in - # windows, this uses the same Popen snippet as python 2 without - # subprocess32 to mask it. Patches are welcome. - # XXX: Should this also include cygwin? - warnings.warn('Timeouts are not implemented on Windows.') - - class Popen(subprocess.Popen): - """Sublcass of Popen that accepts and ignores a timeout argument.""" - def communicate(self, *args, **kwargs): - if 'timeout' in kwargs: - del kwargs['timeout'] - return super(Popen, self).communicate(*args, **kwargs) - - subprocess.Popen = Popen - elif os.name == 'posix': - # This should work for all *nix systems, Linux, the BSDs, and OSX. - # This speicifically creates a session group for each test, so that - # it's children can be killed if it times out. - _EXTRA_POPEN_ARGS = {'start_new_session': True} +_EXTRA_POPEN_ARGS = {} + +if sys.platform == 'win32': + # There is no implementation in piglit to make timeouts work in + # windows, this uses the same Popen snippet as python 2 without + # subprocess32 to mask it. Patches are welcome. + # XXX: Should this also include cygwin? + warnings.warn('Timeouts are not implemented on Windows.') + + class Popen(subprocess.Popen): + """Sublcass of Popen that accepts and ignores a timeout argument.""" + def communicate(self, *args, **kwargs): + if 'timeout' in kwargs: + del kwargs['timeout'] + return super(Popen, self).communicate(*args, **kwargs) + + subprocess.Popen = Popen +elif os.name == 'posix': + # This should work for all *nix systems, Linux, the BSDs, and OSX. + # This speicifically creates a session group for each test, so that + # it's children can be killed if it times out. + _EXTRA_POPEN_ARGS = {'start_new_session': True} # pylint: enable=wrong-import-position,wrong-import-order @@ -153,8 +113,7 @@ def is_crash_returncode(returncode): return returncode < 0 -@six.add_metaclass(abc.ABCMeta) -class Test(object): +class Test(metaclass=abc.ABCMeta): """ Abstract base class for Test classes This class provides the framework for running tests, with several methods @@ -241,7 +200,7 @@ class Test(object): # We know because subtests are ordered that the first test with # a status of NOTRUN is the subtest that crashed, mark that # test and move on. - for k, v in six.iteritems(self.result.subtests): + for k, v in self.result.subtests.items(): if v == status.NOTRUN: self.result.subtests[k] = status.CRASH break @@ -264,13 +223,13 @@ class Test(object): self.result.command = ' '.join(self.command) self.result.environment = " ".join( '{0}="{1}"'.format(k, v) for k, v in itertools.chain( - six.iteritems(OPTIONS.env), six.iteritems(self.env))) + OPTIONS.env.items(), self.env.items())) try: self.is_skip() except TestIsSkip as e: self.result.result = status.SKIP - for each in six.iterkeys(self.result.subtests): + for each in self.result.subtests.keys(): self.result.subtests[each] = status.SKIP self.result.out = e.reason self.result.returncode = None @@ -279,10 +238,10 @@ class Test(object): try: self._run_command() except TestRunError as e: - self.result.result = six.text_type(e.status) - for each in six.iterkeys(self.result.subtests): - self.result.subtests[each] = six.text_type(e.status) - self.result.out = six.text_type(e) + self.result.result = str(e.status) + for each in self.result.subtests.keys(): + self.result.subtests[each] = str(e.status) + self.result.out = str(e) self.result.returncode = None return @@ -321,17 +280,10 @@ class Test(object): # command line options (2) override environment variables (1); and # Piglit considers environment variables set in all.py (3) to be test # requirements. - # - # passing this as unicode is basically broken in python2 on windows, it - # must be passed a bytes. - if six.PY2 and sys.platform.startswith('win32'): - f = six.binary_type - else: - f = six.text_type - _base = itertools.chain(six.iteritems(os.environ), - six.iteritems(OPTIONS.env), - six.iteritems(self.env)) - fullenv = {f(k): f(v) for k, v in _base} + _base = itertools.chain(os.environ.items(), + OPTIONS.env.items(), + self.env.items()) + fullenv = {str(k): str(v) for k, v in _base} try: proc = subprocess.Popen(command, @@ -476,8 +428,7 @@ class ValgrindMixin(object): self.result.result = 'fail' -@six.add_metaclass(abc.ABCMeta) -class ReducedProcessMixin(object): +class ReducedProcessMixin(metaclass=abc.ABCMeta): """This Mixin simplifies writing Test classes that run more than one test in a single process. diff --git a/framework/test/deqp.py b/framework/test/deqp.py index 5db2a922f..abf7b355d 100644 --- a/framework/test/deqp.py +++ b/framework/test/deqp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2014-2016,2018 Intel Corporation +# Copyright 2014-2016, 2018-2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -19,16 +19,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import abc import os import subprocess -import six -from six.moves import range - from framework import core, grouptools, exceptions from framework import options from framework.profile import TestProfile @@ -142,8 +136,7 @@ def iter_deqp_test_cases(case_file): 'deqp: {}:{}: ill-formed line'.format(case_file, i)) -@six.add_metaclass(abc.ABCMeta) -class DEQPBaseTest(Test): +class DEQPBaseTest(Test, metaclass=abc.ABCMeta): __RESULT_MAP = { "Pass": "pass", "Fail": "fail", @@ -190,7 +183,7 @@ class DEQPBaseTest(Test): # otherwise this requires some break/else/continue madness for line in self.result.out.split('\n'): line = line.lstrip() - for k, v in six.iteritems(self.__RESULT_MAP): + for k, v in self.__RESULT_MAP.items(): if line.startswith(k): self.result.result = v return diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py index 980abec4a..5026a43e4 100644 --- a/framework/test/glsl_parser_test.py +++ b/framework/test/glsl_parser_test.py @@ -29,7 +29,6 @@ import os import sys import re import io -import six from framework import exceptions from .base import TestIsSkip @@ -56,10 +55,10 @@ _FORCE_DESKTOP_VERSION = os.environ.get('PIGLIT_FORCE_GLSLPARSER_DESKTOP', False def _is_gles_version(version): """Return True if version is es, otherwsie false.""" - assert not isinstance(version, six.binary_type), \ + assert not isinstance(version, bytes), \ '{}({})'.format(version, type(version)) - if isinstance(version, six.text_type): + if isinstance(version, str): # GLES 3+ versions should have "es" appended, even though # glslparsertest doesn't require them. If the version ends in "es" then # it is a GLES test for sure. @@ -109,7 +108,7 @@ class Parser(object): self.command = self.get_command(filepath, installpath) except GLSLParserInternalError as e: raise exceptions.PiglitFatalError( - 'In file "{}":\n{}'.format(filepath, six.text_type(e))) + 'In file "{}":\n{}'.format(filepath, str(e))) self.set_skip_conditions() diff --git a/framework/test/gtest.py b/framework/test/gtest.py index dbb461368..546a161ff 100644 --- a/framework/test/gtest.py +++ b/framework/test/gtest.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2016 Intel Corporation +# Copyright 2016, 2019 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -24,9 +24,6 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import re from .base import Test diff --git a/framework/test/oclconform.py b/framework/test/oclconform.py index 65b10b2b8..2012047c9 100644 --- a/framework/test/oclconform.py +++ b/framework/test/oclconform.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2016 Intel Corporation +# Copyright 2016, 2019 Intel Corporation # Copyright 2014 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -24,9 +24,6 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import re import subprocess from os.path import join diff --git a/framework/test/opencv.py b/framework/test/opencv.py index 3cbdb02f8..c107d2495 100644 --- a/framework/test/opencv.py +++ b/framework/test/opencv.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2016 Intel Corporation +# Copyright 2016, 2019 Intel Corporation # Copyright 2014 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -24,9 +24,6 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import re import subprocess from os import path diff --git a/framework/test/opengl.py b/framework/test/opengl.py index 0566fb0a8..2f1c5e157 100644 --- a/framework/test/opengl.py +++ b/framework/test/opengl.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,14 +21,9 @@ """Mixins for OpenGL derived tests.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import warnings -import six - from framework import wflinfo from .base import TestIsSkip diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py index 566563059..a14bd03b1 100644 --- a/framework/test/piglit_test.py +++ b/framework/test/piglit_test.py @@ -23,9 +23,6 @@ """ Module provides a base class for Tests """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import glob import os import sys @@ -34,8 +31,6 @@ try: except ImportError: import json -import six - from framework import core, options from framework import status from .base import Test, WindowResizeMixin, ValgrindMixin, TestIsSkip @@ -106,7 +101,7 @@ class PiglitBaseTest(ValgrindMixin, Test): # missing feature. We should fix these tests to do the right thing, but # for the moment this work around will suffice to keep things running. if self.result.raw_result is status.SKIP and self.result.subtests: - for k, v in six.iteritems(self.result.subtests): + for k, v in self.result.subtests.items(): if v is status.NOTRUN: self.result.subtests[k] = status.SKIP diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py index 3f6f7bb0f..44b40f938 100644 --- a/framework/test/shader_test.py +++ b/framework/test/shader_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (C) 2012, 2014-2016 Intel Corporation +# Copyright (C) 2012, 2014-2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -24,9 +24,6 @@ """ This module enables running shader tests. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import io import os import re diff --git a/framework/wflinfo.py b/framework/wflinfo.py index a6bb9e855..eaaa57d4d 100644 --- a/framework/wflinfo.py +++ b/framework/wflinfo.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -19,17 +19,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import errno import os import subprocess import sys import threading -import six - from framework import exceptions from framework.core import lazy_property from framework.options import OPTIONS diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py index a5eafb278..e249ab00c 100644 --- a/generated_tests/builtin_function.py +++ b/generated_tests/builtin_function.py @@ -48,13 +48,11 @@ # swizzling, the function call operator, assignment, and the sequence # operator. -from __future__ import print_function, division, absolute_import import collections import itertools import functools import warnings -from six.moves import range import numpy as np diff --git a/generated_tests/builtin_function_fp64.py b/generated_tests/builtin_function_fp64.py index 6ad8180bb..6776c900d 100644 --- a/generated_tests/builtin_function_fp64.py +++ b/generated_tests/builtin_function_fp64.py @@ -48,12 +48,10 @@ # swizzling, the function call operator, assignment, and the sequence # operator. -from __future__ import print_function, division, absolute_import import collections import itertools import functools -from six.moves import range import numpy as np diff --git a/generated_tests/gen_builtin_packing_tests.py b/generated_tests/gen_builtin_packing_tests.py index 97d31f1f7..9715902a5 100644 --- a/generated_tests/gen_builtin_packing_tests.py +++ b/generated_tests/gen_builtin_packing_tests.py @@ -32,7 +32,6 @@ denormalized) floating point numbers. """ -from __future__ import print_function, division, absolute_import import math import optparse import os diff --git a/generated_tests/gen_builtin_uniform_tests.py b/generated_tests/gen_builtin_uniform_tests.py index ac09a64fc..c9275c4b0 100644 --- a/generated_tests/gen_builtin_uniform_tests.py +++ b/generated_tests/gen_builtin_uniform_tests.py @@ -44,7 +44,6 @@ # With the optional argument --names-only, it only outputs the names # of the files; it doesn't generate them. -from __future__ import print_function, division, absolute_import from builtin_function import * import abc import numpy @@ -52,8 +51,6 @@ import optparse import os import os.path -from six.moves import range - from modules import utils diff --git a/generated_tests/gen_builtin_uniform_tests_fp64.py b/generated_tests/gen_builtin_uniform_tests_fp64.py index 4538c8152..25c52321c 100644 --- a/generated_tests/gen_builtin_uniform_tests_fp64.py +++ b/generated_tests/gen_builtin_uniform_tests_fp64.py @@ -44,7 +44,6 @@ # With the optional argument --names-only, it only outputs the names # of the files; it doesn't generate them. -from __future__ import print_function, division, absolute_import from builtin_function_fp64 import * import abc import numpy @@ -52,8 +51,6 @@ import optparse import os import os.path -from six.moves import range - from modules import utils diff --git a/generated_tests/gen_cl_common_builtins.py b/generated_tests/gen_cl_common_builtins.py index 72969b312..0a51c8402 100644 --- a/generated_tests/gen_cl_common_builtins.py +++ b/generated_tests/gen_cl_common_builtins.py @@ -24,7 +24,6 @@ # Aaron Watry <awatry@gmail.com> # -from __future__ import print_function, division, absolute_import import os from genclbuiltins import gen, NEGNAN diff --git a/generated_tests/gen_cl_int_builtins.py b/generated_tests/gen_cl_int_builtins.py index 6d750ae5e..53531a8ea 100644 --- a/generated_tests/gen_cl_int_builtins.py +++ b/generated_tests/gen_cl_int_builtins.py @@ -1,5 +1,4 @@ # coding=utf-8 -from __future__ import print_function, division, absolute_import import os from genclbuiltins import gen, DATA_SIZES, MAX_VALUES, MAX, MIN, BMIN, BMAX, \ SMIN, SMAX, UMIN, UMAX, TYPE, SIZE, T, U, B diff --git a/generated_tests/gen_cl_math_builtins.py b/generated_tests/gen_cl_math_builtins.py index 566b2dcf3..c934f9ce3 100644 --- a/generated_tests/gen_cl_math_builtins.py +++ b/generated_tests/gen_cl_math_builtins.py @@ -24,7 +24,6 @@ # Aaron Watry <awatry@gmail.com> # -from __future__ import print_function, division, absolute_import import os from genclbuiltins import gen, NEGNAN diff --git a/generated_tests/gen_cl_relational_builtins.py b/generated_tests/gen_cl_relational_builtins.py index 3f0ea49cc..ece651241 100644 --- a/generated_tests/gen_cl_relational_builtins.py +++ b/generated_tests/gen_cl_relational_builtins.py @@ -24,7 +24,6 @@ # Aaron Watry <awatry@gmail.com> # -from __future__ import print_function, division, absolute_import import os from genclbuiltins import gen, TRUE, NEGNAN diff --git a/generated_tests/gen_cl_shuffle2_builtins.py b/generated_tests/gen_cl_shuffle2_builtins.py index 79ded0388..5858dbae1 100644 --- a/generated_tests/gen_cl_shuffle2_builtins.py +++ b/generated_tests/gen_cl_shuffle2_builtins.py @@ -18,11 +18,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function, division, absolute_import import itertools import os import random -import six import textwrap from modules import utils @@ -49,7 +47,7 @@ DIR_NAME = os.path.join("cl", "builtin", "misc") def gen_array(size, m): - return [random.randint(0, m) for i in six.moves.range(size)] + return [random.randint(0, m) for i in range(size)] def permute(data1, data2, mask, ssize, dsize): @@ -90,7 +88,7 @@ def main(): random.seed(0) utils.safe_makedirs(DIR_NAME) - for t, ut in six.iteritems(TYPES): + for t, ut in TYPES.items(): f = begin_test(t, ut) for ss, ds in itertools.product(VEC_SIZES, VEC_SIZES): ssize = int(ss) * ELEMENTS diff --git a/generated_tests/gen_cl_shuffle_builtins.py b/generated_tests/gen_cl_shuffle_builtins.py index 4df8b3d55..8dfb9cdcf 100644 --- a/generated_tests/gen_cl_shuffle_builtins.py +++ b/generated_tests/gen_cl_shuffle_builtins.py @@ -18,11 +18,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function, division, absolute_import import itertools import os import random -import six import textwrap from modules import utils @@ -49,7 +47,7 @@ DIR_NAME = os.path.join("cl", "builtin", "misc") def gen_array(size, m): - return [random.randint(0, m) for i in six.moves.range(size)] + return [random.randint(0, m) for i in range(size)] def permute(data, mask, ssize, dsize): @@ -87,7 +85,7 @@ def main(): random.seed(0) utils.safe_makedirs(DIR_NAME) - for t, ut in six.iteritems(TYPES): + for t, ut in TYPES.items(): f = begin_test(t, ut) for ss, ds in itertools.product(VEC_SIZES, VEC_SIZES): ssize = int(ss) * ELEMENTS diff --git a/generated_tests/gen_cl_store_tests.py b/generated_tests/gen_cl_store_tests.py index fd515c3ac..2121f1919 100644 --- a/generated_tests/gen_cl_store_tests.py +++ b/generated_tests/gen_cl_store_tests.py @@ -24,12 +24,9 @@ # # -from __future__ import print_function, division, absolute_import import os import textwrap -from six.moves import range - from modules import utils TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double'] diff --git a/generated_tests/gen_cl_vload_tests.py b/generated_tests/gen_cl_vload_tests.py index d134a3711..0555e7bab 100644 --- a/generated_tests/gen_cl_vload_tests.py +++ b/generated_tests/gen_cl_vload_tests.py @@ -20,13 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function, division, absolute_import import os import random import textwrap -from six.moves import range - from modules import utils TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'half', 'float', 'double'] diff --git a/generated_tests/gen_cl_vstore_tests.py b/generated_tests/gen_cl_vstore_tests.py index 4e39c6a90..788d26ca4 100644 --- a/generated_tests/gen_cl_vstore_tests.py +++ b/generated_tests/gen_cl_vstore_tests.py @@ -20,13 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function, division, absolute_import import os import random import textwrap -from six.moves import range - from modules import utils TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'half', 'float', 'double'] diff --git a/generated_tests/gen_const_builtin_equal_tests.py b/generated_tests/gen_const_builtin_equal_tests.py index 6fbd5be21..2f5ac3357 100644 --- a/generated_tests/gen_const_builtin_equal_tests.py +++ b/generated_tests/gen_const_builtin_equal_tests.py @@ -21,7 +21,6 @@ """ Generate tests for builtin const equality tests """ -from __future__ import print_function, division, absolute_import import re import os diff --git a/generated_tests/gen_constant_array_size_tests.py b/generated_tests/gen_constant_array_size_tests.py index 7c87d98da..fd3db8ffa 100644 --- a/generated_tests/gen_constant_array_size_tests.py +++ b/generated_tests/gen_constant_array_size_tests.py @@ -34,15 +34,12 @@ # With the optional argument --names-only, it only outputs the names # of the files; it doesn't generate them. -from __future__ import print_function, division, absolute_import from builtin_function import * import abc import optparse import os import os.path -from six.moves import range - from modules import utils class ParserTest(object): diff --git a/generated_tests/gen_constant_array_size_tests_fp64.py b/generated_tests/gen_constant_array_size_tests_fp64.py index 30c591a61..d988101f6 100644 --- a/generated_tests/gen_constant_array_size_tests_fp64.py +++ b/generated_tests/gen_constant_array_size_tests_fp64.py @@ -34,15 +34,12 @@ # With the optional argument --names-only, it only outputs the names # of the files; it doesn't generate them. -from __future__ import print_function, division, absolute_import from builtin_function_fp64 import * import abc import optparse import os import os.path -from six.moves import range - from modules import utils class ParserTest(object): diff --git a/generated_tests/gen_conversion.py b/generated_tests/gen_conversion.py index 810e0ef82..4f4348edb 100644 --- a/generated_tests/gen_conversion.py +++ b/generated_tests/gen_conversion.py @@ -23,7 +23,6 @@ """Generate fp64 and int64 types conversion tests.""" -from __future__ import print_function, division, absolute_import import abc import argparse import itertools diff --git a/generated_tests/gen_extensions_defined.py b/generated_tests/gen_extensions_defined.py index 3b34443a1..f5dd055e5 100644 --- a/generated_tests/gen_extensions_defined.py +++ b/generated_tests/gen_extensions_defined.py @@ -39,9 +39,6 @@ name of the test. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os from templates import template_dir diff --git a/generated_tests/gen_flat_interpolation_qualifier.py b/generated_tests/gen_flat_interpolation_qualifier.py index 7bc464492..2099473ba 100644 --- a/generated_tests/gen_flat_interpolation_qualifier.py +++ b/generated_tests/gen_flat_interpolation_qualifier.py @@ -23,7 +23,6 @@ """Generate non-flat interpolation qualifier tests.""" -from __future__ import print_function, division, absolute_import import argparse import os import itertools diff --git a/generated_tests/gen_gpu_shader4_tests.py b/generated_tests/gen_gpu_shader4_tests.py index b93b54019..4c946b326 100644 --- a/generated_tests/gen_gpu_shader4_tests.py +++ b/generated_tests/gen_gpu_shader4_tests.py @@ -22,7 +22,6 @@ """ Generate spec/EXT_gpu_shader4 tests """ -from __future__ import print_function, division, absolute_import import os import collections diff --git a/generated_tests/gen_inout_fp64.py b/generated_tests/gen_inout_fp64.py index 844f2a9c4..c22bb33d1 100644 --- a/generated_tests/gen_inout_fp64.py +++ b/generated_tests/gen_inout_fp64.py @@ -23,7 +23,6 @@ """Generate in/out fp64 tests.""" -from __future__ import print_function, division, absolute_import import argparse import os import itertools diff --git a/generated_tests/gen_intel_shader_integer_functions2_tests.py b/generated_tests/gen_intel_shader_integer_functions2_tests.py index 7577cdb01..4eb117167 100644 --- a/generated_tests/gen_intel_shader_integer_functions2_tests.py +++ b/generated_tests/gen_intel_shader_integer_functions2_tests.py @@ -27,8 +27,6 @@ import os import numpy as np import random -import six - from templates import template_file from modules import utils @@ -759,7 +757,7 @@ def main(): 'execution', 'built-in-functions') utils.safe_makedirs(dirname) - for func, attrib in six.iteritems(FUNCS): + for func, attrib in FUNCS.items(): TEMPLATE = template_file(os.path.basename(os.path.splitext(__file__)[0]), attrib['template']) diff --git a/generated_tests/gen_interpolation_tests.py b/generated_tests/gen_interpolation_tests.py index f0295e947..006d7f2f4 100644 --- a/generated_tests/gen_interpolation_tests.py +++ b/generated_tests/gen_interpolation_tests.py @@ -67,11 +67,8 @@ This program outputs, to stdout, the name of each file it generates. """ -from __future__ import print_function, division, absolute_import import os -from six.moves import range - from templates import template_file from modules import utils diff --git a/generated_tests/gen_non-lvalue_tests.py b/generated_tests/gen_non-lvalue_tests.py index 1ecd54db8..f0b733a21 100644 --- a/generated_tests/gen_non-lvalue_tests.py +++ b/generated_tests/gen_non-lvalue_tests.py @@ -21,7 +21,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import import os import itertools diff --git a/generated_tests/gen_outerproduct_invalid_params.py b/generated_tests/gen_outerproduct_invalid_params.py index c6b4bba84..762d95b88 100644 --- a/generated_tests/gen_outerproduct_invalid_params.py +++ b/generated_tests/gen_outerproduct_invalid_params.py @@ -19,7 +19,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function, division, absolute_import import os from templates import template_file diff --git a/generated_tests/gen_outerproduct_tests.py b/generated_tests/gen_outerproduct_tests.py index 0828e4b7d..ec6fb0981 100644 --- a/generated_tests/gen_outerproduct_tests.py +++ b/generated_tests/gen_outerproduct_tests.py @@ -21,13 +21,10 @@ """ Generate glsl 1.20 outerproduct tests """ -from __future__ import print_function, division, absolute_import import os import itertools import collections -from six.moves import range - from templates import template_file from modules import utils diff --git a/generated_tests/gen_shader_bit_encoding_tests.py b/generated_tests/gen_shader_bit_encoding_tests.py index 21db127e1..fcdc5dd39 100644 --- a/generated_tests/gen_shader_bit_encoding_tests.py +++ b/generated_tests/gen_shader_bit_encoding_tests.py @@ -21,13 +21,10 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import import struct import os from operator import neg -import six - from templates import template_file from modules import utils @@ -136,7 +133,7 @@ REQUIREMENTS = { def main(): """main function.""" # pylint: disable=line-too-long - for api, requirement in six.iteritems(REQUIREMENTS): + for api, requirement in REQUIREMENTS.items(): version = requirement['version'] extensions = [requirement['extension']] if requirement['extension'] else [] @@ -144,9 +141,9 @@ def main(): 'built-in-functions') utils.safe_makedirs(dirname) - for func, attrib in six.iteritems(FUNCS): + for func, attrib in FUNCS.items(): for execution_stage in ('vs', 'fs'): - for in_modifier_func, modifier_func in six.iteritems(MODIFIER_FUNCS): + for in_modifier_func, modifier_func in MODIFIER_FUNCS.items(): # Modifying the sign of an unsigned number doesn't make sense. if func == 'uintBitsToFloat' and in_modifier_func != '': continue diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py b/generated_tests/gen_shader_framebuffer_fetch_tests.py index 21dc958b8..3171fd809 100644 --- a/generated_tests/gen_shader_framebuffer_fetch_tests.py +++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py @@ -21,8 +21,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import - import os.path from textwrap import dedent diff --git a/generated_tests/gen_shader_image_load_store_tests.py b/generated_tests/gen_shader_image_load_store_tests.py index 11e1e0ae0..34cef3b56 100644 --- a/generated_tests/gen_shader_image_load_store_tests.py +++ b/generated_tests/gen_shader_image_load_store_tests.py @@ -21,7 +21,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import import os.path from mako.template import Template from textwrap import dedent diff --git a/generated_tests/gen_shader_precision_tests.py b/generated_tests/gen_shader_precision_tests.py index 11683a153..38ab37065 100644 --- a/generated_tests/gen_shader_precision_tests.py +++ b/generated_tests/gen_shader_precision_tests.py @@ -49,15 +49,11 @@ This program outputs, to stdout, the name of each file it generates. """ -from __future__ import print_function, division, absolute_import from builtin_function import * import os import numpy import struct -import six -from six.moves import range - from templates import template_file @@ -221,7 +217,7 @@ def drop_signbit(xs): def main(): """ Main function """ - for signature, test_vectors in six.iteritems(test_suite): + for signature, test_vectors in test_suite.items(): arg_float_check = all(arg.base_type == glsl_float for arg in signature.argtypes) arg_mat_check = any(arg.is_matrix for arg in signature.argtypes) # Filter the test vectors down to only those which deal exclusively in diff --git a/generated_tests/gen_tcs_input_tests.py b/generated_tests/gen_tcs_input_tests.py index 01e938ccd..face4f19a 100644 --- a/generated_tests/gen_tcs_input_tests.py +++ b/generated_tests/gen_tcs_input_tests.py @@ -37,14 +37,11 @@ This script outputs, to stdout, the name of each file it generates. """ -from __future__ import print_function, division, absolute_import import os import sys import random import textwrap -from six.moves import range - class Test(object): def __init__(self, type_name, array, name): diff --git a/generated_tests/gen_tes_input_tests.py b/generated_tests/gen_tes_input_tests.py index faf0f0d59..3d847b5cc 100644 --- a/generated_tests/gen_tes_input_tests.py +++ b/generated_tests/gen_tes_input_tests.py @@ -40,14 +40,11 @@ This script outputs, to stdout, the name of each file it generates. """ -from __future__ import print_function, absolute_import, division import os import sys import random import textwrap -from six.moves import range - class Test(object): def __init__(self, type_name, array, patch_in, name): diff --git a/generated_tests/gen_texture_lod_tests.py b/generated_tests/gen_texture_lod_tests.py index eb286b65c..8b5b6e720 100644 --- a/generated_tests/gen_texture_lod_tests.py +++ b/generated_tests/gen_texture_lod_tests.py @@ -21,7 +21,6 @@ """ Generate spec/ARB_shader_texture_lod tests """ -from __future__ import print_function, division, absolute_import import os import collections diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py index bee84bffa..9f6117312 100644 --- a/generated_tests/gen_texture_query_lod_tests.py +++ b/generated_tests/gen_texture_query_lod_tests.py @@ -21,12 +21,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import import os import os.path -import six - from templates import template_file from modules import utils @@ -84,13 +81,13 @@ REQUIREMENTS = { def main(): """Main function.""" - for api, requirement in six.iteritems(REQUIREMENTS): + for api, requirement in REQUIREMENTS.items(): lod = 'Lod' if api == 'glsl-4.00' else 'LOD' dirname = os.path.join("spec", api.lower(), "compiler", "built-in-functions") utils.safe_makedirs(dirname) - for sampler_type, coord_type in six.iteritems(SAMPLER_TYPE_TO_COORD_TYPE): + for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.items(): requirements = [requirement['extensions']] if requirement['extensions'] else [] # samplerCubeArray types are part GLSL 4.00 diff --git a/generated_tests/gen_uniform_initializer_tests.py b/generated_tests/gen_uniform_initializer_tests.py index b65af9dd5..7b0b5b1c0 100644 --- a/generated_tests/gen_uniform_initializer_tests.py +++ b/generated_tests/gen_uniform_initializer_tests.py @@ -21,11 +21,8 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import import os -from six.moves import range - from templates import template_dir from modules import utils diff --git a/generated_tests/gen_variable_index_read_tests.py b/generated_tests/gen_variable_index_read_tests.py index 09e9b558b..fd028b515 100644 --- a/generated_tests/gen_variable_index_read_tests.py +++ b/generated_tests/gen_variable_index_read_tests.py @@ -21,12 +21,9 @@ """Generate tests for glsl 1.10 and 1.20 variable index reads.""" -from __future__ import print_function, absolute_import, division import os import itertools -from six.moves import range - from templates import template_dir from modules.utils import lazy_property, safe_makedirs diff --git a/generated_tests/gen_variable_index_write_tests.py b/generated_tests/gen_variable_index_write_tests.py index 15cb7bccf..e1920fdbf 100644 --- a/generated_tests/gen_variable_index_write_tests.py +++ b/generated_tests/gen_variable_index_write_tests.py @@ -27,16 +27,10 @@ The template then formats that information into a shader_test for either the fragment shader stage or the vertex shader stage. """ - -from __future__ import ( - print_function, absolute_import, division, unicode_literals -) import copy import itertools import os -from six.moves import range # pylint: disable=redefined-builtin - from modules import utils, glsl from templates import template_dir diff --git a/generated_tests/gen_vp_tex.py b/generated_tests/gen_vp_tex.py index b7c229a53..7312e6f5c 100644 --- a/generated_tests/gen_vp_tex.py +++ b/generated_tests/gen_vp_tex.py @@ -26,9 +26,6 @@ Romanick. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os from templates import template_dir diff --git a/generated_tests/gen_vs_in_fp64.py b/generated_tests/gen_vs_in_fp64.py index 3804e06bf..69b010b93 100644 --- a/generated_tests/gen_vs_in_fp64.py +++ b/generated_tests/gen_vs_in_fp64.py @@ -23,15 +23,12 @@ """Generate fp64 vertex shader input tests.""" -from __future__ import print_function, division, absolute_import import abc import argparse import itertools import os import types -from six.moves import range - from templates import template_dir from modules import utils from modules import types as glsltypes diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py index 2aaad1851..d9086d319 100644 --- a/generated_tests/genclbuiltins.py +++ b/generated_tests/genclbuiltins.py @@ -1,13 +1,10 @@ # coding=utf-8 -from __future__ import print_function, division, absolute_import import os -import six - __all__ = ['gen', 'DATA_SIZES', 'MAX_VALUES', 'MAX', 'MIN', 'BMIN', 'BMAX', 'SMIN', 'SMAX', 'UMIN', 'UMAX', 'TYPE', 'T', 'U', 'B'] -_NUMERIC_TYPES = tuple(list(six.integer_types) + [float]) +_NUMERIC_TYPES = tuple([int, float]) DATA_SIZES = { diff --git a/generated_tests/interpolation-qualifier-built-in-variable.py b/generated_tests/interpolation-qualifier-built-in-variable.py index bff55f173..2d408c8be 100644 --- a/generated_tests/interpolation-qualifier-built-in-variable.py +++ b/generated_tests/interpolation-qualifier-built-in-variable.py @@ -23,7 +23,6 @@ """Generate interpolation-qualifier tests.""" -from __future__ import print_function, division, absolute_import import os import itertools diff --git a/generated_tests/modules/__init__.py b/generated_tests/modules/__init__.py index 293fafd17..6dfd6518b 100644 --- a/generated_tests/modules/__init__.py +++ b/generated_tests/modules/__init__.py @@ -5,5 +5,3 @@ import sys sys.path.insert(0, os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', 'framework'))) - -importlib.import_module('compat') diff --git a/generated_tests/modules/glsl.py b/generated_tests/modules/glsl.py index 18b34a992..ca52987f9 100644 --- a/generated_tests/modules/glsl.py +++ b/generated_tests/modules/glsl.py @@ -21,15 +21,8 @@ """Provides helper classes for representing glsl data.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import functools -import six - -import compat - __all__ = [ 'GLSLESVersion', 'GLSLVersion', @@ -74,7 +67,7 @@ class _Version(object): def __call__(self, ver): """Make a Version object, or provide one from the cache.""" - assert isinstance(ver, six.text_type) + assert isinstance(ver, str) # Try to get an object from the cache, if that fails create a new one # and add it to the cache before returning it. @@ -95,7 +88,6 @@ class _Version(object): Version = _Version() # pylint: disable=invalid-name -@compat.python_2_unicode_compatible # pylint: disable=no-member @functools.total_ordering class GLSLVersion(object): """A Representation of an OpenGL Shading Language version. @@ -152,7 +144,6 @@ class GLSLVersion(object): return '{:.2f}'.format(float(self)) -@compat.python_2_unicode_compatible # pylint: disable=no-member @functools.total_ordering class GLSLESVersion(object): """Represents a GLSL ES version. diff --git a/generated_tests/modules/types.py b/generated_tests/modules/types.py index 2b1eb3d21..0486c2fd3 100644 --- a/generated_tests/modules/types.py +++ b/generated_tests/modules/types.py @@ -35,12 +35,6 @@ checking. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - -import six - from .utils import lazy_property @@ -65,7 +59,7 @@ class Container(object): assert [is_scalar, is_vector, is_matrix].count(True) == 1, \ 'A type must be exactly one of: scalar, vector, matrix' assert isinstance(contains, Type), 'contains must be a type instance' - assert isinstance(name, six.text_type), 'name must be string' + assert isinstance(name, str), 'name must be string' assert columns is None or isinstance(columns, int), \ 'columns must be an int if provided' assert rows is None or isinstance(rows, int), \ diff --git a/generated_tests/modules/utils.py b/generated_tests/modules/utils.py index fc4f77901..cedeb1631 100644 --- a/generated_tests/modules/utils.py +++ b/generated_tests/modules/utils.py @@ -21,7 +21,6 @@ """Helper functions for test generators.""" -from __future__ import print_function, absolute_import import os import errno import functools diff --git a/generated_tests/random_ubo.py b/generated_tests/random_ubo.py index 042b8b7a7..8886b10cc 100644 --- a/generated_tests/random_ubo.py +++ b/generated_tests/random_ubo.py @@ -21,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function import random import abc import collections diff --git a/generated_tests/random_ubo_trim.py b/generated_tests/random_ubo_trim.py index 5ae21bf06..d920bb0c1 100644 --- a/generated_tests/random_ubo_trim.py +++ b/generated_tests/random_ubo_trim.py @@ -21,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import print_function import os import sys import errno diff --git a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako index 4c053bf89..d82782468 100644 --- a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako +++ b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako @@ -1,4 +1,3 @@ -<%! from six.moves import range %> ## Test execution of pack2x16 functions in the fragment shader. [require] ${func.requirements} diff --git a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako index ee610bbfb..3269a6f57 100644 --- a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako +++ b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako @@ -1,4 +1,3 @@ -<%! from six.moves import range %> ## Test execution of unpack2x16 functions in the fragment shader. [require] ${func.requirements} diff --git a/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako index 5f37d7eaf..65b9dabb1 100644 --- a/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako +++ b/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako @@ -1,4 +1,3 @@ -<%! from six.moves import range %> ## Test execution of pack2x16 functions in the vertex shader. [require] ${func.requirements} diff --git a/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako index 5f2a39125..a3776bcb3 100644 --- a/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako +++ b/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako @@ -1,4 +1,3 @@ -<%! from six.moves import range %> ## Test execution of unpack2x16 functions in the vertex shader. [require] ${func.requirements} diff --git a/generated_tests/templates/gen_conversion/execution_base.mako b/generated_tests/templates/gen_conversion/execution_base.mako index 09a3223b7..1e38eb198 100644 --- a/generated_tests/templates/gen_conversion/execution_base.mako +++ b/generated_tests/templates/gen_conversion/execution_base.mako @@ -3,7 +3,6 @@ <% (glsl_version, glsl_version_int) = self.versioning() %>\ -<%! from six.moves import range %>\ [require] GLSL >= ${glsl_version} % for extension in extensions: diff --git a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/absoluteDifference.shader_test.mako b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/absoluteDifference.shader_test.mako index 606d66af9..df1a67ce0 100644 --- a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/absoluteDifference.shader_test.mako +++ b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/absoluteDifference.shader_test.mako @@ -1,5 +1,4 @@ <%! -import six import numpy as np %> [require] diff --git a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/addSaturate.shader_test.mako b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/addSaturate.shader_test.mako index 9abf2e941..d3bbd5161 100644 --- a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/addSaturate.shader_test.mako +++ b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/addSaturate.shader_test.mako @@ -1,5 +1,4 @@ <%! -import six import numpy as np %> [require] diff --git a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/countLeadingZeros.shader_test.mako b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/countLeadingZeros.shader_test.mako index a98823848..52bd0e507 100644 --- a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/countLeadingZeros.shader_test.mako +++ b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/countLeadingZeros.shader_test.mako @@ -1,4 +1,3 @@ -<%! import six %> [require] GL >= 3.0 GLSL >= 1.30 diff --git a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/multiply32x16.shader_test.mako b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/multiply32x16.shader_test.mako index 7c3eda492..1e0e84a73 100644 --- a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/multiply32x16.shader_test.mako +++ b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/multiply32x16.shader_test.mako @@ -1,5 +1,4 @@ <%! -import six import numpy as np %> [require] diff --git a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/subtractSaturate.shader_test.mako b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/subtractSaturate.shader_test.mako index ce111ab89..a98a1ede3 100644 --- a/generated_tests/templates/gen_intel_shader_integer_functions2_tests/subtractSaturate.shader_test.mako +++ b/generated_tests/templates/gen_intel_shader_integer_functions2_tests/subtractSaturate.shader_test.mako @@ -1,5 +1,4 @@ <%! -import six import numpy as np %> [require] diff --git a/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako index 8c2d6c9af..d6240e6ed 100644 --- a/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako +++ b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako @@ -18,10 +18,6 @@ ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ## SOFTWARE. -<%! - from six.moves import range -%> - <%def name="spec()"> /* From page 43 (page 49 of the PDF) of the GLSL 1.20 spec: * diff --git a/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako b/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako index a7f49d9c4..adb6c9a09 100644 --- a/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako +++ b/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako @@ -1,4 +1,3 @@ -<%! import six %> [require] GLSL >= ${version} % for extension in extensions: @@ -74,7 +73,7 @@ vertex/float/2 -1.0 1.0 [test] -% for name, data in sorted(six.iteritems(test_data)): +% for name, data in sorted(test_data.items()): % if name == '-0.0' and in_modifier_func != '' and func == 'intBitsToFloat': # ${in_modifier_func}(INT_MIN) doesn't fit in a 32-bit int. Cannot test. % else: diff --git a/generated_tests/templates/gen_shader_precision_tests/fs.mako b/generated_tests/templates/gen_shader_precision_tests/fs.mako index a556badee..2ec60755b 100644 --- a/generated_tests/templates/gen_shader_precision_tests/fs.mako +++ b/generated_tests/templates/gen_shader_precision_tests/fs.mako @@ -1,6 +1,3 @@ -<%! - from six.moves import range -%>\ [require] GLSL >= 4.00 GL_ARB_shader_precision diff --git a/generated_tests/templates/gen_shader_precision_tests/gs.mako b/generated_tests/templates/gen_shader_precision_tests/gs.mako index d37a42b99..8393f538a 100644 --- a/generated_tests/templates/gen_shader_precision_tests/gs.mako +++ b/generated_tests/templates/gen_shader_precision_tests/gs.mako @@ -1,6 +1,3 @@ -<%! - from six.moves import range -%>\ [require] GLSL >= 4.00 GL_ARB_shader_precision diff --git a/generated_tests/templates/gen_shader_precision_tests/vs.mako b/generated_tests/templates/gen_shader_precision_tests/vs.mako index 7ccdadca6..25a0f8444 100644 --- a/generated_tests/templates/gen_shader_precision_tests/vs.mako +++ b/generated_tests/templates/gen_shader_precision_tests/vs.mako @@ -1,6 +1,3 @@ -<%! - from six.moves import range -%>\ [require] GLSL >= 4.00 GL_ARB_shader_precision diff --git a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako index 155eb8c4e..a008e2707 100644 --- a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako +++ b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako @@ -17,9 +17,7 @@ ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ## SOFTWARE. -<%! - from six.moves import range - +<%! def dedent(text): return '\n'.join(l.lstrip() for l in text.splitlines()) diff --git a/generated_tests/templates/gen_variable_index_write_tests/helpers.mako b/generated_tests/templates/gen_variable_index_write_tests/helpers.mako index 8d688a8c9..997d1ea33 100644 --- a/generated_tests/templates/gen_variable_index_write_tests/helpers.mako +++ b/generated_tests/templates/gen_variable_index_write_tests/helpers.mako @@ -21,13 +21,11 @@ <%! import textwrap - from six.moves import range - def clean_block(block): """Clean a block of text that is meant to have no indent or newlines. Removes blank lines and any leading or trailing whitespaces. - + """ ret = [] for l in block.splitlines(): @@ -50,7 +48,7 @@ else: ret.append(l) return '\n'.join(ret) - + %> <%def name="license()" filter="textwrap.dedent"> diff --git a/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako b/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako index f094a0315..c00448476 100644 --- a/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako +++ b/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako @@ -20,8 +20,6 @@ ## SOFTWARE. <%! - from six.moves import range - def _version(ver): if ver == 'GL_ARB_vertex_attrib_64bit': glsl_version_int = '150' diff --git a/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako b/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako index 5620cbe33..24a79f27c 100644 --- a/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako +++ b/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako @@ -20,8 +20,6 @@ ## SOFTWARE. <%! - from six.moves import range - def _version(ver): if ver == 'GL_ARB_vertex_attrib_64bit': glsl_version_int = '150' @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2014 Intel Corporation +# Copyright (c) 2014, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -31,16 +31,11 @@ capture -h/--help and the results will not be useful. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import argparse import os import os.path as path import sys -import six - def setup_module_search_path(): """Add Piglit's data directory to Python's module search path. @@ -115,10 +110,7 @@ import framework.programs.print_commands as pc def main(): """ Parse argument and call other executables """ - if six.PY2: - input_ = [i.decode('utf-8') for i in sys.argv[1:]] - elif six.PY3: - input_ = sys.argv[1:] + input_ = sys.argv[1:] parser = argparse.ArgumentParser() subparsers = parser.add_subparsers() diff --git a/piglit-print-commands.py b/piglit-print-commands.py index 8dcb13289..dc8af6133 100755 --- a/piglit-print-commands.py +++ b/piglit-print-commands.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding=utf-8 # Copyright (c) 2014, 2016 Intel Corporation @@ -27,17 +27,9 @@ Deprecated compatibility wrapper """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import sys -import six - from framework.programs.print_commands import main if __name__ == '__main__': - if six.PY2: - main([i.decode('utf-8') for i in sys.argv[1:]]) - elif six.PY3: - main(sys.argv[1:]) + main(sys.argv[1:]) diff --git a/piglit-resume.py b/piglit-resume.py index 94e8deae4..b665113a9 100755 --- a/piglit-resume.py +++ b/piglit-resume.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -27,16 +27,8 @@ Deprecated compatibility wrapper """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import sys -import six - from framework.programs.run import resume -if six.PY2: - resume([i.decode('utf-8') for i in sys.argv[1:]]) -elif six.PY3: - resume(sys.argv[1:]) +resume(sys.argv[1:]) diff --git a/piglit-run.py b/piglit-run.py index f37420ab5..8cf218bf3 100755 --- a/piglit-run.py +++ b/piglit-run.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -27,16 +27,8 @@ Deprecated compatibility wrapper """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import sys -import six - from framework.programs.run import run -if six.PY2: - run([i.decode('utf-8') for i in sys.argv[1:]]) -elif six.PY3: - run(sys.argv[1:]) +run(sys.argv[1:]) diff --git a/piglit-summary-html.py b/piglit-summary-html.py index 302b0b3af..415fa1a16 100755 --- a/piglit-summary-html.py +++ b/piglit-summary-html.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,16 +23,8 @@ """ Deprecated compatibility wrapper for html summary """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import sys -import six - from framework.programs.summary import html -if six.PY2: - html([i.decode('utf-8') for i in sys.argv[1:]]) -elif six.PY3: - html(sys.argv[1:]) +html(sys.argv[1:]) diff --git a/piglit-summary.py b/piglit-summary.py index 3214d8e2f..a9584ea89 100755 --- a/piglit-summary.py +++ b/piglit-summary.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,16 +23,8 @@ """ Deprecated compatibility wrapper for console summary """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import sys -import six - from framework.programs.summary import console -if six.PY2: - console([i.decode('utf-8') for i in sys.argv[1:]]) -elif six.PY3: - console(sys.argv[1:]) +console(sys.argv[1:]) diff --git a/registry/gl.py b/registry/gl.py index 0ebddf13b..795703819 100644 --- a/registry/gl.py +++ b/registry/gl.py @@ -24,18 +24,12 @@ Parse gl.xml into Python objects. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import os.path import re import sys import functools from copy import copy, deepcopy -import six - # Export 'debug' so other Piglit modules can easily enable it. debug = False @@ -174,7 +168,7 @@ class OrderedKeyedSet(object): # pair has form {key: [prev, next, key, value])}. self.__map = dict() - if isinstance(key, six.text_type): + if isinstance(key, str): self.__key_func = lambda elem: getattr(elem, key) else: self.__key_func = key @@ -255,13 +249,13 @@ class OrderedKeyedSet(object): return node[3] def sort_by_key(self): - sorted_items = sorted(six.iteritems(self.__map)) + sorted_items = sorted(self.__map.items()) self.clear() for item in sorted_items: self.add(item[1]) def sort_by_value(self): - sorted_values = sorted(six.itervalues(self.__map)) + sorted_values = sorted(self.__map.values()) self.clear() for value in sorted_values: self.add(value) @@ -932,7 +926,7 @@ class CommandAliasMap(object): """A sorted iterator over the map's unique CommandAliasSet values.""" if self.__sorted_unique_values is None: self.__sorted_unique_values = \ - sorted(set(six.itervalues(self.__map))) + sorted(set(self.__map.values())) return iter(self.__sorted_unique_values) @@ -1138,13 +1132,7 @@ class Enum(object): else: base = 10 - if six.PY2: - # long is undefined in python3, and we are aware of that - # pylint: disable=undefined-variable - self.num_value = long(self.str_value, base) - else: - assert six.PY3 - self.num_value = int(self.str_value, base) + self.num_value = int(self.str_value, base) _log_debug('parsed {0}'.format(self)) diff --git a/templates/feature.mako b/templates/feature.mako index 1a8eae1e1..11296ad32 100644 --- a/templates/feature.mako +++ b/templates/feature.mako @@ -2,9 +2,6 @@ import posixpath # this must be posixpath, since we want /'s not \'s import re - from six.moves import range - - def feat_result(result): """Percentage result string""" return '{}/{}'.format(result[0], result[1]) diff --git a/templates/index.mako b/templates/index.mako index f9b453e80..688533b6f 100644 --- a/templates/index.mako +++ b/templates/index.mako @@ -3,9 +3,6 @@ import posixpath # this must be posixpath, since we want /'s not \'s import re - import six - from six.moves import range - from framework import grouptools, status def group_changes(test, current): @@ -24,7 +21,7 @@ return status.NOTRUN return max([status.status_lookup(s) for s, v in - six.iteritems(result.totals[group]) if v > 0]) + result.totals[group].items() if v > 0]) def group_fraction(result, group): """Get the fraction value for a group.""" @@ -33,7 +30,7 @@ num = 0 den = 0 - for k, v in six.iteritems(result.totals[group]): + for k, v in result.totals[group].items(): if v > 0: s = status.status_lookup(k) num += s.fraction[0] * v @@ -143,7 +140,7 @@ </tr><tr> % endfor % endif - + <td> <div class="group" style="margin-left: ${depth * 1.75}em"> ${grouptools.testname(test) | h} diff --git a/templates/testrun_info.mako b/templates/testrun_info.mako index d18327bcc..202c7321b 100644 --- a/templates/testrun_info.mako +++ b/templates/testrun_info.mako @@ -1,6 +1,3 @@ -<%! - import six -%> <!DOCTYPE html> <html lang="en"> <head> diff --git a/tests/crucible.py b/tests/crucible.py index 79fa70c52..f36e3ab28 100644 --- a/tests/crucible.py +++ b/tests/crucible.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2014-2016 Intel Corporation +# Copyright 2014-2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,11 +25,7 @@ upstream: https://gitlab.freedesktop.org/mesa/crucible/ """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os -import six import subprocess import tempfile @@ -66,7 +62,7 @@ class CrucibleTest(Test): def interpret_result(self): try: test = backends.junit.REGISTRY.load(self.__out_xml, 'none') - result = test.get_result(next(six.iterkeys(test.tests))) + result = test.get_result(next(test.tests.keys())) self.result.result = result.name super(CrucibleTest, self).interpret_result() except etree.ParseError: diff --git a/tests/cts_gl.py b/tests/cts_gl.py index 734b88cbe..ea43fa3f5 100644 --- a/tests/cts_gl.py +++ b/tests/cts_gl.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -42,9 +42,6 @@ PIGLIT_CTS_GL_EXTRA_ARGS -- environment equivalent of [cts_gl]:extra_args """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/cts_gl45.py b/tests/cts_gl45.py index c46899f13..50c08ff29 100644 --- a/tests/cts_gl45.py +++ b/tests/cts_gl45.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -37,9 +37,6 @@ PIGLIT_CTS_GL_EXTRA_ARGS -- environment equivalent of [cts_gl]:extra_args """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/cts_gles.py b/tests/cts_gles.py index b083d11a1..c03796fda 100644 --- a/tests/cts_gles.py +++ b/tests/cts_gles.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -43,9 +43,6 @@ PIGLIT_CTS_GLES_EXTRA_ARGS -- environment equivalent of [cts_gles]:extra_args """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/deqp_egl.py b/tests/deqp_egl.py index ccd40b2af..7de1b83d4 100644 --- a/tests/deqp_egl.py +++ b/tests/deqp_egl.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2015-2016 Intel Corporation +# Copyright © 2015-2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Piglit integrations for dEQP EGL tests.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.test import deqp from framework.options import OPTIONS diff --git a/tests/deqp_gles2.py b/tests/deqp_gles2.py index 8f9bee706..f85cc1506 100644 --- a/tests/deqp_gles2.py +++ b/tests/deqp_gles2.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2015 Intel Corporation +# Copyright 2015, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Piglit integrations for dEQP GLES2 tests.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.test import deqp from framework.options import OPTIONS diff --git a/tests/deqp_gles3.py b/tests/deqp_gles3.py index 0fed6b3fa..3c2683427 100644 --- a/tests/deqp_gles3.py +++ b/tests/deqp_gles3.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2014, 2015 Intel Corporation +# Copyright 2014, 2015, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Piglit integrations for dEQP GLES3 tests.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import warnings diff --git a/tests/deqp_gles31.py b/tests/deqp_gles31.py index e9ca0f346..fd76e3e83 100644 --- a/tests/deqp_gles31.py +++ b/tests/deqp_gles31.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2015 Intel Corporation +# Copyright 2015, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Piglit integrations for dEQP GLES31 tests.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.test import deqp from framework.options import OPTIONS diff --git a/tests/deqp_vk.py b/tests/deqp_vk.py index 8c1a2bd59..78dc29fd1 100644 --- a/tests/deqp_vk.py +++ b/tests/deqp_vk.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2014-2016 Intel Corporation +# Copyright 2014-2016, 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,9 +25,6 @@ upstream: https://github.com/KhronosGroup/Vulkan-CTS """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import re from framework.test import deqp diff --git a/tests/find_static_tests.py b/tests/find_static_tests.py index c5f24ca18..08f9d56f6 100644 --- a/tests/find_static_tests.py +++ b/tests/find_static_tests.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2018 Intel Corporation +# Copyright © 2018-2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,15 +21,10 @@ """Script that finds all static tests of one kind or another.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import argparse import io import os -import six - def main(): parser = argparse.ArgumentParser() @@ -61,12 +56,6 @@ def main(): for filename in filenames: if os.path.splitext(filename)[1] in exts: name = os.path.join(dirpath, filename) - if six.PY2: - # This might not be correct, but it's fine. As long as the - # two files are the same it'll work, and utf-8 is what - # everyone *should* be using, and as a superset of ascii - # *should* cover most people - name = name.decode('utf-8', 'replace') files.append(name) if os.path.exists(args.output): diff --git a/tests/glslparser.py b/tests/glslparser.py index 8f2a13663..a56981ef7 100644 --- a/tests/glslparser.py +++ b/tests/glslparser.py @@ -1,9 +1,6 @@ # coding=utf-8 """A profile that runs only GLSLParserTest instances.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os from framework import grouptools diff --git a/tests/gtf_gl.py b/tests/gtf_gl.py index a82f091d5..3e7789944 100644 --- a/tests/gtf_gl.py +++ b/tests/gtf_gl.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2018 Intel Corporation +# Copyright (c) 2018, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -43,9 +43,6 @@ PIGLIT_GTF_GL_EXTRA_ARGS -- environment equivalent of [gtf_gl]:extra_args """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/gtf_gles.py b/tests/gtf_gles.py index ca91f14b6..9853d6ca2 100644 --- a/tests/gtf_gles.py +++ b/tests/gtf_gles.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2018 Intel Corporation +# Copyright (c) 2018-2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -45,9 +45,6 @@ PIGLIT_GTF_GLES_EXTRA_ARGS -- environment equivalent of """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/igt.py b/tests/igt.py index c3ec2e647..261c09f0a 100644 --- a/tests/igt.py +++ b/tests/igt.py @@ -33,10 +33,6 @@ drm. Even if you have rendernode support enabled. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import os import re import subprocess diff --git a/tests/khr_gl.py b/tests/khr_gl.py index 235ca7c8c..ab7b83ff0 100644 --- a/tests/khr_gl.py +++ b/tests/khr_gl.py @@ -44,9 +44,6 @@ PIGLIT_KHR_GL_EXTRA_ARGS -- environment equivalent of [khr_gl]:extra_args """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/khr_gl45.py b/tests/khr_gl45.py index cdb46833c..74ea27362 100644 --- a/tests/khr_gl45.py +++ b/tests/khr_gl45.py @@ -38,9 +38,6 @@ PIGLIT_KHR_GL_EXTRA_ARGS -- environment equivalent of [khr_gl45]:extra_args """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/khr_gles.py b/tests/khr_gles.py index 13cae08a2..92b79992d 100644 --- a/tests/khr_gles.py +++ b/tests/khr_gles.py @@ -46,9 +46,6 @@ PIGLIT_KHR_GLES_EXTRA_ARGS -- environment equivalent of """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/khr_noctx.py b/tests/khr_noctx.py index 04f0d3073..4f30a4893 100644 --- a/tests/khr_noctx.py +++ b/tests/khr_noctx.py @@ -45,9 +45,6 @@ PIGLIT_KHR_NOCTX_EXTRA_ARGS -- environment equivalent of """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools from framework.test import deqp diff --git a/tests/llvmpipe_gl.py b/tests/llvmpipe_gl.py index 71b41433c..9efa7d1fd 100644 --- a/tests/llvmpipe_gl.py +++ b/tests/llvmpipe_gl.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import platform import sys diff --git a/tests/no_error.py b/tests/no_error.py index 9b53c6cb4..7799cef02 100644 --- a/tests/no_error.py +++ b/tests/no_error.py @@ -1,12 +1,7 @@ # -*- coding: utf-8 -*- -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools -import six - from tests.quick_gl import profile as _profile1 from tests.quick_shader import profile as _profile2 from framework.test import PiglitGLTest @@ -22,8 +17,8 @@ profile.filters = _profile1.filters + _profile2.filters # Add a modified version of each PiglitGLTest as a khr_no_error variant. # Shader runner doesn't explitly test for expected errors so we add shader # tests as is. We actively filter GLSL parser and any other type of tests. -for name, test in itertools.chain(six.iteritems(_profile1.test_list), - six.iteritems(_profile2.test_list)): +for name, test in itertools.chain(_profile1.test_list.items(), + _profile2.test_list.items()): if isinstance(test, (PiglitGLTest, ShaderTest, MultiShaderTest)): profile.test_list['{} khr_no_error'.format(name)] = test test.command += ['-khr_no_error'] diff --git a/tests/oglconform.py b/tests/oglconform.py index 2d81b6b2b..36adbabdc 100644 --- a/tests/oglconform.py +++ b/tests/oglconform.py @@ -22,9 +22,6 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import re import subprocess diff --git a/tests/opencl_foreign.py b/tests/opencl_foreign.py index 76efaf6d4..d58984add 100644 --- a/tests/opencl_foreign.py +++ b/tests/opencl_foreign.py @@ -21,10 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.profile import TestProfile from framework.test import add_opencv_tests, add_oclconform_tests diff --git a/tests/opengl.py b/tests/opengl.py index b4d6dcee4..a0ddffe43 100644 --- a/tests/opengl.py +++ b/tests/opengl.py @@ -1,15 +1,10 @@ # -*- coding: utf-8 -*- # All tests that come with piglit, using default settings -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools import os import platform -from six.moves import range - from framework import grouptools from framework import options from framework.profile import TestProfile diff --git a/tests/quick_gl.py b/tests/quick_gl.py index 1f5d4d960..ec21d2b7d 100644 --- a/tests/quick_gl.py +++ b/tests/quick_gl.py @@ -10,10 +10,6 @@ don't want that level of exhaustiveness, so this filter removes 80% in a random (but deterministic) way. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework import grouptools from framework.test import PiglitGLTest from tests.opengl import profile as _profile diff --git a/tests/quick_shader.py b/tests/quick_shader.py index f1bda6545..51f7cdb19 100644 --- a/tests/quick_shader.py +++ b/tests/quick_shader.py @@ -19,9 +19,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import random from framework import grouptools diff --git a/tests/sanity.py b/tests/sanity.py index 12f1614c9..7a837435a 100644 --- a/tests/sanity.py +++ b/tests/sanity.py @@ -30,9 +30,6 @@ hardware or software stacks the "gpu" or "quick" profiles are probably more appropriate. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os from framework import grouptools diff --git a/tests/serializer.py b/tests/serializer.py index b330eb034..82a163dd7 100644 --- a/tests/serializer.py +++ b/tests/serializer.py @@ -27,8 +27,6 @@ import os import sys import xml.etree.cElementTree as et -import six - sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) from framework.test.piglit_test import ( @@ -75,7 +73,7 @@ def _serialize_skips(test, elem): def serializer(name, profile, outfile): """Take each test in the profile and write it out into the xml.""" # TODO: This is going to take a lot of memory - root = et.Element('PiglitTestList', count=six.text_type(len(profile)), + root = et.Element('PiglitTestList', count=str(len(profile)), name=name) for name, test in profile.itertests(): if isinstance(test, PiglitGLTest): @@ -136,7 +134,7 @@ def serializer(name, profile, outfile): et.SubElement(elem, 'option', name='cwd', value=test.cwd) if test.env: env = et.SubElement(elem, 'environment') - for k, v in six.iteritems(test.env): + for k, v in test.env.items(): et.SubElement(env, 'env', name=k, value=v) tree = et.ElementTree(root) diff --git a/tests/shader.py b/tests/shader.py index 14f21eef9..849273660 100644 --- a/tests/shader.py +++ b/tests/shader.py @@ -1,15 +1,9 @@ # coding=utf-8 """A profile that runs only ShaderTest instances.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections import os -from six.moves import zip -import six - from framework.options import OPTIONS from framework import grouptools from framework.profile import TestProfile @@ -55,7 +49,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]: # Because we need to handle duplicate group names in TESTS and GENERATED_TESTS # this dictionary is constructed, then added to the actual test dictionary. -for group, files in six.iteritems(shader_tests): +for group, files in shader_tests.items(): assert group not in profile.test_list, 'duplicate group: {}'.format(group) # We'll end up with a list of tuples, split that into two lists diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py index 44b04fd38..47cc249ec 100644 --- a/tests/util/gen_dispatch.py +++ b/tests/util/gen_dispatch.py @@ -25,10 +25,6 @@ Generate C source code from Khronos XML. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import argparse import os.path import re @@ -36,7 +32,6 @@ import sys import functools from collections import namedtuple -import six import mako.runtime import mako.template @@ -111,14 +106,7 @@ def render_template(filename, out_dir, **context_vars): if debug: print('fake whitespace: before: {0!r}'.format(proto_text)) - if six.PY2: - # the unicode function was removed in python3, this will raise a - # pylint error, but not in python2 - # pylint: disable=undefined-variable - text = unicode(proto_text) - elif six.PY3: - text = proto_text - + text = proto_text text = fake_alignment.sub('', text) text = fake_tab.sub('\t', text) if debug: diff --git a/tests/vulkan.py b/tests/vulkan.py index 3ab526d86..ff4b6e2b7 100644 --- a/tests/vulkan.py +++ b/tests/vulkan.py @@ -2,10 +2,6 @@ # -*- coding: utf-8 -*- """All Vulkan tests that come with piglit, using default settings.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import os from framework.profile import TestProfile diff --git a/tests/xts-render.py b/tests/xts-render.py index 025412327..841e4fb2c 100644 --- a/tests/xts-render.py +++ b/tests/xts-render.py @@ -20,10 +20,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from tests.xts import profile as _profile __all__ = ['profile'] diff --git a/tests/xts.py b/tests/xts.py index 8e9a685dc..c83e6c02d 100644 --- a/tests/xts.py +++ b/tests/xts.py @@ -24,9 +24,6 @@ """ Test integreation for the X Test Suite """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import re import subprocess diff --git a/unittests/framework/backends/shared.py b/unittests/framework/backends/shared.py index 59b30c9aa..ad93dd40c 100644 --- a/unittests/framework/backends/shared.py +++ b/unittests/framework/backends/shared.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2016 Intel Corporation +# Copyright © 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Shared data for backend tests.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.options import OPTIONS diff --git a/unittests/framework/backends/test_compression.py b/unittests/framework/backends/test_compression.py index 6d463ada4..e19428575 100644 --- a/unittests/framework/backends/test_compression.py +++ b/unittests/framework/backends/test_compression.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Tests for compression in file backends.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools import os import subprocess @@ -33,7 +30,6 @@ except ImportError: from unittest import mock import pytest -import six from framework import core from framework.backends import abstract @@ -70,19 +66,6 @@ def _has_xz_bin(): return True -requires_lzma = pytest.mark.skipif( # pylint: disable=invalid-name - six.PY2 and not _has_lzma(), - reason="Python 2.x requires backports.lzma to run this test.") - -requires_xz_bin = pytest.mark.skipif( # pylint: disable=invalid-name - _has_lzma() or not _has_xz_bin(), - reason="Python 2.x requires xz binary to run this test.") - -requires_any_lzma = pytest.mark.skipif( # pylint: disable=invalid-name - six.PY2 and not (_has_lzma() or _has_xz_bin()), - reason="Python 2.x requires some form of xz compression to run this test.") - - @pytest.yield_fixture def env(): with mock.patch.dict('os.environ'): @@ -135,7 +118,7 @@ def compressor(): # Tests -@pytest.mark.parametrize("mode", ['none', 'bz2', 'gz', requires_lzma('xz')]) +@pytest.mark.parametrize("mode", ['none', 'bz2', 'gz', 'xz']) def test_compress(mode, tmpdir): """Test that each compressor that we want works. @@ -145,11 +128,11 @@ def test_compress(mode, tmpdir): """ func = compression.COMPRESSORS[mode] testfile = tmpdir.join('test') - with func(six.text_type(testfile)) as f: + with func(str(testfile)) as f: f.write('foo') -@pytest.mark.parametrize("mode", ['none', 'bz2', 'gz', requires_lzma('xz')]) +@pytest.mark.parametrize("mode", ['none', 'bz2', 'gz', 'xz']) def test_decompress(mode, tmpdir): """Test that each supported decompressor works. @@ -159,18 +142,16 @@ def test_decompress(mode, tmpdir): dec = compression.DECOMPRESSORS[mode] testfile = tmpdir.join('test') - with comp(six.text_type(testfile)) as f: + with comp(str(testfile)) as f: f.write('foo') - with dec(six.text_type(testfile)) as f: + with dec(str(testfile)) as f: actual = f.read() assert actual == 'foo' @skip.posix -@skip.PY3 -@requires_xz_bin class TestXZBin(object): """Tests for the xz bin path on python2.x.""" @@ -178,7 +159,7 @@ class TestXZBin(object): """Test python2 xz compression using the xz binary.""" func = compression.COMPRESSORS['xz'] testfile = tmpdir.join('test') - with func(six.text_type(testfile)) as f: + with func(str(testfile)) as f: f.write('foo') def test_decompress_xz_bin(self, tmpdir): @@ -187,10 +168,10 @@ class TestXZBin(object): dec = compression.DECOMPRESSORS['xz'] testfile = tmpdir.join('test') - with comp(six.text_type(testfile)) as f: + with comp(str(testfile)) as f: f.write('foo') - with dec(six.text_type(testfile)) as f: + with dec(str(testfile)) as f: actual = f.read() assert actual == 'foo' @@ -231,7 +212,7 @@ class TestGetMode(object): assert compression.get_mode() == 'foobar' -@pytest.mark.parametrize("extension", ['bz2', 'gz', requires_any_lzma('xz')]) +@pytest.mark.parametrize("extension", ['bz2', 'gz', 'xz']) def test_duplicate_extensions(extension, tmpdir, config): """Tests that exersizes a bug that caused the compressed extension to be duplicated in some cases. @@ -252,11 +233,8 @@ def test_changed_extension(orig, new, tmpdir, config): """Tests that exersizes a bug that caused two extensions to be present if the compression method changed. """ - if 'xz' in [new, orig] and six.PY2 and not (_has_lzma() or _has_xz_bin()): - pytest.skip("There is no xz compressor available.") - tmpdir.chdir() - config.set('core', 'compression', six.text_type(new)) + config.set('core', 'compression', str(new)) with abstract.write_compressed('results.txt.' + orig) as f: f.write('foo') diff --git a/unittests/framework/backends/test_json.py b/unittests/framework/backends/test_json.py index 2ee1e47ce..362c85e6f 100644 --- a/unittests/framework/backends/test_json.py +++ b/unittests/framework/backends/test_json.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -36,7 +36,6 @@ except ImportError: import jsonschema import pytest -import six from framework import backends from framework import exceptions @@ -65,7 +64,7 @@ class TestJSONBackend(object): """Tests for the initialize method.""" def test_metadata_file_created(self, tmpdir): - p = six.text_type(tmpdir) + p = str(tmpdir) test = backends.json.JSONBackend(p) test.initialize(shared.INITIAL_METADATA) assert os.path.exists(os.path.join(p, 'metadata.json')) @@ -75,7 +74,7 @@ class TestJSONBackend(object): def test_write(self, tmpdir): """The write method should create a file.""" - p = six.text_type(tmpdir) + p = str(tmpdir) test = backends.json.JSONBackend(p) test.initialize(shared.INITIAL_METADATA) @@ -91,7 +90,7 @@ class TestJSONBackend(object): handled elsewhere), instead it just attempts a touch test of "can this be read as JSON". """ - p = six.text_type(tmpdir) + p = str(tmpdir) test = backends.json.JSONBackend(p) test.initialize(shared.INITIAL_METADATA) @@ -110,7 +109,7 @@ class TestJSONBackend(object): @pytest.fixture(scope='class') def result_dir(self, tmpdir_factory): directory = tmpdir_factory.mktemp('main') - test = backends.json.JSONBackend(six.text_type(directory)) + test = backends.json.JSONBackend(str(directory)) test.initialize(shared.INITIAL_METADATA) with test.write_test(self.name) as t: t(self.result) @@ -148,7 +147,7 @@ class TestJSONBackend(object): jsonschema.validate(json_, schema) def test_ignores_invalid(self, tmpdir): - test = backends.json.JSONBackend(six.text_type(tmpdir)) + test = backends.json.JSONBackend(str(tmpdir)) test.initialize(shared.INITIAL_METADATA) with test.write_test(self.name) as t: t(self.result) @@ -175,7 +174,7 @@ class TestUpdateResults(object): with p.open('r') as f: base = backends.json._load(f) - backends.json._update_results(base, six.text_type(p)) + backends.json._update_results(base, str(p)) class TestResume(object): @@ -186,11 +185,11 @@ class TestResume(object): p.write('') with pytest.raises(AssertionError): - backends.json._resume(six.text_type(p)) + backends.json._resume(str(p)) def test_load_valid_folder(self, tmpdir): """backends.json._resume: loads valid results.""" - backend = backends.json.JSONBackend(six.text_type(tmpdir)) + backend = backends.json.JSONBackend(str(tmpdir)) backend.initialize(shared.INITIAL_METADATA) with backend.write_test("group1/test1") as t: t(results.TestResult('fail')) @@ -198,7 +197,7 @@ class TestResume(object): t(results.TestResult('pass')) with backend.write_test("group2/test3") as t: t(results.TestResult('fail')) - test = backends.json._resume(six.text_type(tmpdir)) + test = backends.json._resume(str(tmpdir)) assert set(test.tests.keys()) == \ {'group1/test1', 'group1/test2', 'group2/test3'} @@ -208,7 +207,7 @@ class TestResume(object): This gets triggered by an incomplete atomic write """ - f = six.text_type(tmpdir) + f = str(tmpdir) backend = backends.json.JSONBackend(f) backend.initialize(shared.INITIAL_METADATA) with backend.write_test("group1/test1") as t: @@ -233,7 +232,7 @@ class TestResume(object): doing a refactor to split some code out and allow this to be done in the resume path. """ - f = six.text_type(tmpdir) + f = str(tmpdir) backend = backends.json.JSONBackend(f) backend.initialize(shared.INITIAL_METADATA) with backend.write_test("group1/test1") as t: @@ -260,20 +259,20 @@ class TestLoadResults(object): p = tmpdir.join('results.json') with p.open('w') as f: f.write(json.dumps(shared.JSON)) - backends.json.load_results(six.text_type(tmpdir), 'none') + backends.json.load_results(str(tmpdir), 'none') def test_load_file(self, tmpdir): """backends.json.load_results: Loads a file passed by name""" p = tmpdir.join('my file') with p.open('w') as f: f.write(json.dumps(shared.JSON)) - backends.json.load_results(six.text_type(p), 'none') + backends.json.load_results(str(p), 'none') def test_inst(self, tmpdir): p = tmpdir.join('my file') with p.open('w') as f: f.write(json.dumps(shared.JSON)) - assert isinstance(backends.json.load_results(six.text_type(p), 'none'), + assert isinstance(backends.json.load_results(str(p), 'none'), results.TestrunResult) diff --git a/unittests/framework/backends/test_json_update.py b/unittests/framework/backends/test_json_update.py index c832886aa..882944b99 100644 --- a/unittests/framework/backends/test_json_update.py +++ b/unittests/framework/backends/test_json_update.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Tests for JSON backend version updates.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os try: import simplejson as json diff --git a/unittests/framework/backends/test_junit.py b/unittests/framework/backends/test_junit.py index 260b24099..09ae011fa 100644 --- a/unittests/framework/backends/test_junit.py +++ b/unittests/framework/backends/test_junit.py @@ -21,9 +21,6 @@ """Tests for the Junit backend package.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import textwrap try: @@ -36,7 +33,6 @@ except ImportError: from unittest import mock import pytest -import six from framework import backends from framework import grouptools @@ -91,7 +87,7 @@ class TestProtectedLoad(object): """ p = tmpdir.join('foobar.xml') p.write(_XML) - test = backends.junit.REGISTRY.load(six.text_type(p), 'none') + test = backends.junit.REGISTRY.load(str(p), 'none') assert test.name == 'foobar' def test_folder_name(self, tmpdir): @@ -101,7 +97,7 @@ class TestProtectedLoad(object): tmpdir.mkdir('foo') p = tmpdir.join('foo', 'results.xml') p.write(_XML) - test = backends.junit.REGISTRY.load(six.text_type(p), 'none') + test = backends.junit.REGISTRY.load(str(p), 'none') assert test.name == 'foo' @@ -114,7 +110,7 @@ class TestProtectedLoad(object): def result(self, tmpdir): p = tmpdir.join('test.xml') p.write(_XML) - return backends.junit._load(six.text_type(p)) + return backends.junit._load(str(p)) def test_testrunresult(self, result): """backends.junit._load: returns a TestrunResult instance.""" @@ -182,7 +178,7 @@ class TestJUnitBackend(object): result.err = 'this is stderr' result.command = 'foo' - test = backends.junit.JUnitBackend(six.text_type(tmpdir)) + test = backends.junit.JUnitBackend(str(tmpdir)) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) @@ -205,13 +201,13 @@ class TestJUnitWriter(object): result.err = 'this is stderr' result.command = 'foo' - test = backends.junit.JUnitBackend(six.text_type(tmpdir)) + test = backends.junit.JUnitBackend(str(tmpdir)) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) test.finalize() - test_value = etree.parse(six.text_type(tmpdir.join('results.xml'))) + test_value = etree.parse(str(tmpdir.join('results.xml'))) test_value = test_value.getroot() assert test_value.find('.//testcase').attrib['classname'] == \ @@ -231,7 +227,7 @@ class TestJUnitWriter(object): result.command = 'foo' result.pid = 1034 - test = backends.junit.JUnitBackend(six.text_type(p)) + test = backends.junit.JUnitBackend(str(p)) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) @@ -241,7 +237,7 @@ class TestJUnitWriter(object): t(result) test.finalize() - return six.text_type(p.join('results.xml')) + return str(p.join('results.xml')) def test_xml_well_formed(self, test_file): """backends.junit.JUnitBackend.write_test: produces well formed xml.""" @@ -272,14 +268,14 @@ class TestJUnitSubtestWriter(object): result.subtests['foo'] = 'pass' result.subtests['bar'] = 'fail' - test = backends.junit.JUnitBackend(six.text_type(tmpdir), + test = backends.junit.JUnitBackend(str(tmpdir), junit_subtests=True) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) test.finalize() - test_value = etree.parse(six.text_type(tmpdir.join('results.xml'))) + test_value = etree.parse(str(tmpdir.join('results.xml'))) test_value = test_value.getroot() assert test_value.find('.//testsuite/testsuite').attrib['name'] == \ @@ -297,7 +293,7 @@ class TestJUnitSubtestWriter(object): result.subtests['foo'] = 'pass' result.subtests['bar'] = 'fail' - test = backends.junit.JUnitBackend(six.text_type(tmpdir), + test = backends.junit.JUnitBackend(str(tmpdir), junit_subtests=True, junit_suffix='.foo') test.initialize(shared.INITIAL_METADATA) @@ -305,7 +301,7 @@ class TestJUnitSubtestWriter(object): t(result) test.finalize() - test_value = etree.parse(six.text_type(tmpdir.join('results.xml'))) + test_value = etree.parse(str(tmpdir.join('results.xml'))) test_value = test_value.getroot() suite = test_value.find('.//testsuite/testsuite') @@ -321,14 +317,14 @@ class TestJUnitSubtestWriter(object): result.subtests['foo'] = 'pass' result.subtests['bar'] = 'skip' - test = backends.junit.JUnitBackend(six.text_type(tmpdir), + test = backends.junit.JUnitBackend(str(tmpdir), junit_subtests=True) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) test.finalize() - test_value = etree.parse(six.text_type(tmpdir.join('results.xml'))) + test_value = etree.parse(str(tmpdir.join('results.xml'))) test_value = test_value.getroot() suite = test_value.find('.//testsuite/testsuite') @@ -344,14 +340,14 @@ class TestJUnitSubtestWriter(object): result.command = 'foo' result.result = 'skip' - test = backends.junit.JUnitBackend(six.text_type(tmpdir), + test = backends.junit.JUnitBackend(str(tmpdir), junit_subtests=True) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) test.finalize() - test_value = etree.parse(six.text_type(tmpdir.join('results.xml'))) + test_value = etree.parse(str(tmpdir.join('results.xml'))) test_value = test_value.getroot() elem = test_value.find('.//testsuite/testcase[@name="test1"]/skipped') @@ -366,14 +362,14 @@ class TestJUnitSubtestWriter(object): result.subtests['foo'] = 'pass' result.subtests['bar'] = 'skip' - test = backends.junit.JUnitBackend(six.text_type(tmpdir), + test = backends.junit.JUnitBackend(str(tmpdir), junit_subtests=True) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: t(result) test.finalize() - test_value = etree.parse(six.text_type(tmpdir.join('results.xml'))) + test_value = etree.parse(str(tmpdir.join('results.xml'))) test_value = test_value.getroot() suite = test_value.find('.//testsuite/testsuite') @@ -395,7 +391,7 @@ class TestJUnitSubtestWriter(object): result.subtests['foo'] = 'pass' result.subtests['bar'] = 'fail' - test = backends.junit.JUnitBackend(six.text_type(p), + test = backends.junit.JUnitBackend(str(p), junit_subtests=True) test.initialize(shared.INITIAL_METADATA) with test.write_test(grouptools.join('a', 'group', 'test1')) as t: @@ -406,7 +402,7 @@ class TestJUnitSubtestWriter(object): t(result) test.finalize() - return six.text_type(p.join('results.xml')) + return str(p.join('results.xml')) def test_xml_well_formed(self, test_file): """backends.junit.JUnitBackend.write_test: produces well formed xml.""" diff --git a/unittests/framework/backends/test_package.py b/unittests/framework/backends/test_package.py index 08df6f0f4..954c036d6 100644 --- a/unittests/framework/backends/test_package.py +++ b/unittests/framework/backends/test_package.py @@ -21,12 +21,7 @@ """ Tests for the backend package """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest -import six from framework import backends @@ -104,15 +99,15 @@ class TestLoad(object): p = tmpdir.join('foo.test_backend') p.write('foo') - test = backends.load(six.text_type(p)) - assert [six.text_type(p)] == test + test = backends.load(str(p)) + assert [str(p)] == test def test_unknown(self, tmpdir): p = tmpdir.join('foo.test_extension') p.write('foo') with pytest.raises(backends.BackendError): - backends.load(six.text_type(p)) + backends.load(str(p)) def test_interupted(self, tmpdir, mock_backend): # pylint: disable=unused-argument,redefined-outer-name """backends.load: works for resuming (no extension known).""" @@ -120,7 +115,7 @@ class TestLoad(object): with tmpdir.join('tests', '0.test_backend').open('w') as f: f.write('foo') - backends.load(six.text_type(tmpdir)) + backends.load(str(tmpdir)) def test_notimplemented(self, tmpdir, mocker): """backends.load(): An error is raised if a loader isn't properly @@ -138,7 +133,7 @@ class TestLoad(object): p.write('foo') with pytest.raises(backends.BackendNotImplementedError): - backends.load(six.text_type(p)) + backends.load(str(p)) def test_trailing_dot(self, mocker): """framework.backends.load: handles the result name ending in '.'. @@ -170,7 +165,7 @@ class TestLoad(object): f.write('foo') with pytest.raises(backends.BackendError): - backends.load(six.text_type(p)) + backends.load(str(p)) class TestSetMeta(object): diff --git a/unittests/framework/skip.py b/unittests/framework/skip.py index 4600c7a9f..4a3bcf3a9 100644 --- a/unittests/framework/skip.py +++ b/unittests/framework/skip.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2016 Intel corporation +# Copyright © 2016, 2019 Intel corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,19 +25,13 @@ There are a number of repeated conditions for skipping, python version, os name or class, etc. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import sys import pytest -import six # pylint: disable=invalid-name -PY2 = pytest.mark.skipif(six.PY2, reason="Test isn't relavent on python 2.x") -PY3 = pytest.mark.skipif(six.PY3, reason="Test isn't relavent on python 3.x") posix = pytest.mark.skipif( os.name != 'posix', reason="Test is only relavent on posix systems.") windows = pytest.mark.skipif( diff --git a/unittests/framework/summary/test_common.py b/unittests/framework/summary/test_common.py index fd2a0f34d..8aba931d1 100644 --- a/unittests/framework/summary/test_common.py +++ b/unittests/framework/summary/test_common.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -22,12 +22,7 @@ """Tests for framework/summary/common.py""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest -from six.moves import range from framework import grouptools from framework import results diff --git a/unittests/framework/summary/test_console.py b/unittests/framework/summary/test_console.py index ccc91e137..2bdb84529 100644 --- a/unittests/framework/summary/test_console.py +++ b/unittests/framework/summary/test_console.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,12 +25,7 @@ Some of these tests are fickle, since we're testing the output of a summary generator. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest -import six from framework import results from framework import grouptools @@ -60,7 +55,7 @@ _ENUMS = { class TestPrintSummary(object): """Tests for the console output.""" - @pytest.mark.parametrize("index", six.iterkeys(_ENUMS), ids=lambda i: _ENUMS[i]) + @pytest.mark.parametrize("index", _ENUMS.keys(), ids=lambda i: _ENUMS[i]) def test_values(self, index, capsys): """Create both an expected value and an actual value. diff --git a/unittests/framework/summary/test_feature.py b/unittests/framework/summary/test_feature.py index 905484991..750be42b3 100644 --- a/unittests/framework/summary/test_feature.py +++ b/unittests/framework/summary/test_feature.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2016 Intel Corporation +# Copyright © 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Tests for the feature summary module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) try: import simplejson as json except ImportError: @@ -34,7 +31,6 @@ except ImportError: from unittest import mock import pytest -import six from framework import grouptools from framework import results @@ -87,14 +83,14 @@ class TestFeatResult(object): p.write(json.dumps(DATA)) result = results.TestrunResult() - for n, s in six.iteritems(PROFILE.test_list): + for n, s in PROFILE.test_list.items(): result.tests[n] = s.result result.options['profile'] = [None] result.name = 'foo' with mock.patch('framework.summary.feature.profile.load_test_profile', mock.Mock(return_value=PROFILE)): - return feature.FeatResults([result], six.text_type(p)) + return feature.FeatResults([result], str(p)) def test_basic(self, feature): """The fixture works.""" diff --git a/unittests/framework/summary/test_html.py b/unittests/framework/summary/test_html.py index a9d192bfe..b80d68fd0 100644 --- a/unittests/framework/summary/test_html.py +++ b/unittests/framework/summary/test_html.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,19 +23,14 @@ # pylint: disable=protected-access -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os -import six - from framework.summary import html_ def test_copy_static(tmpdir): """summary.html_._copy_static: puts status content in correct locations""" tmpdir.chdir() - html_._copy_static_files(six.text_type(tmpdir)) + html_._copy_static_files(str(tmpdir)) assert os.path.exists('index.css'), 'index.css not created correctly' assert os.path.exists('result.css'), 'result.css not created correctly' diff --git a/unittests/framework/test/test_base.py b/unittests/framework/test/test_base.py index f8d0aa051..2230a47bf 100644 --- a/unittests/framework/test/test_base.py +++ b/unittests/framework/test/test_base.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """ Tests for the exectest module """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import textwrap try: @@ -32,9 +29,6 @@ except ImportError: import subprocess import pytest -import six - -from six.moves import range from framework import dmesg from framework import log @@ -72,8 +66,6 @@ class TestTest(object): t.run() - @pytest.mark.skipif(six.PY2 and subprocess.__name__ != 'subprocess32', - reason='Python 2.7 requires subprocess32 to run this test') @skip.posix class TestRunCommand(object): """Tests for Test._run_command.""" @@ -146,8 +138,7 @@ class TestTest(object): # store it so we can access it later proxy = PopenProxy() - test = _Test(['python' + ('2' if six.PY2 else '3'), - six.text_type(f)]) + test = _Test(['python3', str(f)]) test.timeout = 1 # mock out subprocess.Popen with our proxy object @@ -210,7 +201,7 @@ class TestTest(object): test = _Test(['foo']) test.run = mocker.Mock(side_effect=self.Sentinal) - test.execute(mocker.Mock(spec=six.text_type), + test.execute(mocker.Mock(spec=str), mocker.Mock(spec=log.BaseLog), {'dmesg': mocker.Mock(spec=dmesg.BaseDmesg), 'monitor': mocker.Mock(spec=monitoring.Monitoring)}) @@ -229,7 +220,7 @@ class TestTest(object): there is a value. """ assert shared_test.traceback != '' - assert isinstance(shared_test.traceback, six.string_types) + assert isinstance(shared_test.traceback, str) def test_exception(self, shared_test): """Test.execute (exception): Sets the exception. @@ -238,7 +229,7 @@ class TestTest(object): value, so just make sure it's being set. """ assert shared_test.exception != '' - assert isinstance(shared_test.exception, six.string_types) + assert isinstance(shared_test.exception, str) class TestCommand(object): """Tests for Test.command.""" @@ -386,10 +377,10 @@ class TestValgrindMixin(object): # The ids function here is a bit of a hack to work around the # pytest-timeout plugin, which is broken. when 'timeout' is passed as a - # string using six.text_type it tries to grab that value and a flaming - # pile ensues + # string using str it tries to grab that value and a flaming pile + # ensues @pytest.mark.parametrize("starting", PROBLEMS, - ids=lambda x: six.text_type(x).upper()) + ids=lambda x: str(x).upper()) def test_problem_status_changes_valgrind_enabled(self, starting, mocker): """When running with valgrind mode we're actually testing the test binary itself, so any status other than pass is irrelavent, and @@ -405,7 +396,7 @@ class TestValgrindMixin(object): assert test.result.result is status.SKIP @pytest.mark.parametrize("starting", PROBLEMS, - ids=lambda x: six.text_type(x).upper()) + ids=lambda x: str(x).upper()) def test_problems_with_valgrind_disabled(self, starting, mocker): """When valgrind is disabled nothign shoud change """ diff --git a/unittests/framework/test/test_deqp.py b/unittests/framework/test/test_deqp.py index b7c1db4eb..e52ac5c12 100644 --- a/unittests/framework/test/test_deqp.py +++ b/unittests/framework/test/test_deqp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,9 +26,6 @@ tests """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import textwrap try: from unittest import mock @@ -36,7 +33,6 @@ except ImportError: import mock import pytest -import six from framework import exceptions from framework import grouptools @@ -128,7 +124,7 @@ class TestIterDeqpTestCases(object): """Run the acutal test.""" p = tmpdir.join('foo') p.write(write) - gen = deqp.iter_deqp_test_cases(six.text_type(p)) + gen = deqp.iter_deqp_test_cases(str(p)) assert next(gen) == expect def test_test_cases(self, tmpdir): @@ -310,7 +306,7 @@ dEQP.piglit.nested.group2.test4 def test_basic(self, tmpdir): p = tmpdir.join('foo.txt') p.write(self._txt) - tests = set(deqp.gen_mustpass_tests(six.text_type(p))) + tests = set(deqp.gen_mustpass_tests(str(p))) print(tests) assert tests == { 'dEQP.piglit.group1.test1', diff --git a/unittests/framework/test/test_glsl_parser_test.py b/unittests/framework/test/test_glsl_parser_test.py index 1d4476932..50f6d6aa2 100644 --- a/unittests/framework/test/test_glsl_parser_test.py +++ b/unittests/framework/test/test_glsl_parser_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Tests for framework.test.glsl_parser_test.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools import os import textwrap @@ -35,7 +32,6 @@ except ImportError: # pylint: enable=import-error import pytest -import six from framework import exceptions from framework.test import glsl_parser_test as glsl @@ -84,7 +80,7 @@ def test_no_config_start(tmpdir): // [end config]""")) with pytest.raises(glsl.GLSLParserNoConfigError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) def test_find_config_start(tmpdir): @@ -97,7 +93,7 @@ def test_find_config_start(tmpdir): // glsl_version: 1.10""")) with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) def test_no_config_end(tmpdir): @@ -107,7 +103,7 @@ def test_no_config_end(tmpdir): p.write('// [config]') with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) def test_no_expect_result(tmpdir): @@ -120,7 +116,7 @@ def test_no_expect_result(tmpdir): // [end config]""")) with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) def test_no_glsl_version(tmpdir): @@ -133,7 +129,7 @@ def test_no_glsl_version(tmpdir): // [end config]""")) with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) def test_cpp_comments(tmpdir): @@ -145,10 +141,10 @@ def test_cpp_comments(tmpdir): // expect_result: pass // glsl_version: 1.10 // [end config]""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'), - six.text_type(p), 'pass', '1.10'] + str(p), 'pass', '1.10'] def test_c_comments(tmpdir): @@ -162,10 +158,10 @@ def test_c_comments(tmpdir): * [end config] */""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'), - six.text_type(p), 'pass', '1.10'] + str(p), 'pass', '1.10'] def test_blank_in_config_cpp(tmpdir): @@ -178,10 +174,10 @@ def test_blank_in_config_cpp(tmpdir): // expect_result: pass // glsl_version: 1.10 // [end config]""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'), - six.text_type(p), 'pass', '1.10'] + str(p), 'pass', '1.10'] def test_empty_in_config_cpp(tmpdir): @@ -194,10 +190,10 @@ def test_empty_in_config_cpp(tmpdir): // expect_result: pass // glsl_version: 1.10 // [end config]""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'), - six.text_type(p), 'pass', '1.10'] + str(p), 'pass', '1.10'] def test_blank_in_config_c(tmpdir): @@ -211,10 +207,10 @@ def test_blank_in_config_c(tmpdir): * glsl_version: 1.10 * [end config] */""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'), - six.text_type(p), 'pass', '1.10'] + str(p), 'pass', '1.10'] def test_empty_in_config_c(tmpdir): @@ -228,10 +224,10 @@ def test_empty_in_config_c(tmpdir): * glsl_version: 1.10 * [end config] */""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'), - six.text_type(p), 'pass', '1.10'] + str(p), 'pass', '1.10'] @pytest.mark.parametrize( @@ -254,9 +250,9 @@ def test_config_to_command(config, expected, tmpdir): """Test that config blocks are converted into the expected commands.""" p = tmpdir.join('test.frag') p.write(config) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) # add the filename, which isn't known util now - expected.insert(1, six.text_type(p)) + expected.insert(1, str(p)) assert test.command == expected @@ -273,7 +269,7 @@ def test_bad_section_name(tmpdir): // [end config]""")) with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) @pytest.mark.parametrize( @@ -294,7 +290,7 @@ def test_duplicate_entry(extra, tmpdir): // [end config]""".format(extra))) with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) @pytest.mark.parametrize( @@ -314,7 +310,7 @@ def test_invalid_extensions_separator(separator, tmpdir): // [end config]""".format(separator))) with pytest.raises(exceptions.PiglitFatalError): - glsl.GLSLParserTest.new(six.text_type(p)) + glsl.GLSLParserTest.new(str(p)) @pytest.mark.parametrize( @@ -334,7 +330,7 @@ def test_valid_extensions(ext, tmpdir): // [end config]""".format(ext))) expected = ext.split(' ') - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) assert test.command[-len(expected):] == expected @@ -365,7 +361,7 @@ def test_get_glslparsertest_gles2(version, forced, tmpdir, mocker): * glsl_version: {} * [end config] */""".format(version))) - inst = glsl.GLSLParserTest.new(six.text_type(p)) + inst = glsl.GLSLParserTest.new(str(p)) assert os.path.basename(inst.command[0]) == expected @@ -395,12 +391,12 @@ class TestGLSLParserTestSkipRequirements(object): def test_glsl(self, tmpdir): p = tmpdir.join('test.frag') self.write_config(p) - assert glsl.GLSLParserTest.new(six.text_type(p)).require_shader == 4.3 + assert glsl.GLSLParserTest.new(str(p)).require_shader == 4.3 def test_glsl_es(self, tmpdir): p = tmpdir.join('test.frag') self.write_config(p, version='3.0') - assert glsl.GLSLParserTest.new(six.text_type(p)).require_shader == 3.0 + assert glsl.GLSLParserTest.new(str(p)).require_shader == 3.0 @pytest.mark.parametrize( @@ -410,18 +406,18 @@ class TestGLSLParserTestSkipRequirements(object): def test_apis(self, tmpdir, value, expected): p = tmpdir.join('test.frag') self.write_config(p, version=value) - assert glsl.GLSLParserTest.new(six.text_type(p)).require_api == expected + assert glsl.GLSLParserTest.new(str(p)).require_api == expected def test_require_extensions(self, tmpdir): p = tmpdir.join('test.frag') self.write_config(p, extra="require_extensions: GL_ARB_foo GL_ARB_bar") - assert glsl.GLSLParserTest.new(six.text_type(p)).require_extensions == \ + assert glsl.GLSLParserTest.new(str(p)).require_extensions == \ {'GL_ARB_foo', 'GL_ARB_bar'} def test_exclude_not_added_to_require_extensions(self, tmpdir): p = tmpdir.join('test.frag') self.write_config(p, extra="require_extensions: GL_ARB_foo !GL_ARB_bar") - assert glsl.GLSLParserTest.new(six.text_type(p)).require_extensions == \ + assert glsl.GLSLParserTest.new(str(p)).require_extensions == \ {'GL_ARB_foo'} @@ -438,7 +434,7 @@ def test_skip_desktop_without_binary(tmpdir, mocker): * glsl_version: 1.10 * [end config] */""")) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) with pytest.raises(_TestIsSkip): test.is_skip() @@ -467,7 +463,7 @@ def test_add_compatibility_requirement_fastskip(version, extension, tmpdir, * require_extensions: GL_ARB_ham_sandwhich * [end config] */""".format(version))) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) # The arb_compat extension was added to the fast skipping arguments assert extension in test.require_extensions @@ -497,7 +493,7 @@ def test_add_compatibility_requirement_binary(version, extension, tmpdir, * require_extensions: GL_ARB_ham_sandwhich * [end config] */""".format(version))) - test = glsl.GLSLParserTest.new(six.text_type(p)) + test = glsl.GLSLParserTest.new(str(p)) # The compat extension was added to the slow skipping (C level) # requirements diff --git a/unittests/framework/test/test_gtest.py b/unittests/framework/test/test_gtest.py index 900402123..449b6d659 100644 --- a/unittests/framework/test/test_gtest.py +++ b/unittests/framework/test/test_gtest.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,11 +21,6 @@ """ Module providing tests for gtest """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - - from framework.test import GTest from framework import status diff --git a/unittests/framework/test/test_opencv.py b/unittests/framework/test/test_opencv.py index 83d017d83..fedd67d27 100644 --- a/unittests/framework/test/test_opencv.py +++ b/unittests/framework/test/test_opencv.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Module for testing opencv.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.test import OpenCVTest diff --git a/unittests/framework/test/test_opengl.py b/unittests/framework/test/test_opengl.py index e051787c5..aa6042430 100644 --- a/unittests/framework/test/test_opengl.py +++ b/unittests/framework/test/test_opengl.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Test the opengl module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) try: from unittest import mock except ImportError: diff --git a/unittests/framework/test/test_piglit_test.py b/unittests/framework/test/test_piglit_test.py index fa906ca2d..c555fd06e 100644 --- a/unittests/framework/test/test_piglit_test.py +++ b/unittests/framework/test/test_piglit_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Tests for the piglit_test module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import textwrap try: from unittest import mock @@ -32,7 +29,6 @@ except ImportError: import pytest - from framework import status from framework.options import _Options as Options from framework.test.base import TestIsSkip as _TestIsSkip diff --git a/unittests/framework/test/test_shader_test.py b/unittests/framework/test/test_shader_test.py index e9a12a40e..f224d2d9a 100644 --- a/unittests/framework/test/test_shader_test.py +++ b/unittests/framework/test/test_shader_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """ Provides tests for the shader_test module """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import os import textwrap try: @@ -32,7 +29,6 @@ except ImportError: from unittest import mock import pytest -import six from framework import status from framework.test import shader_test @@ -95,7 +91,7 @@ class TestConfigParsing(object): [next section] """.format(operator, gles))) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert os.path.basename(test.command[0]) == expected @@ -107,7 +103,7 @@ class TestConfigParsing(object): GL ES >= 3.0 GLSL ES >= 3.00 es """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert os.path.basename(test.command[0]) == "shader_runner_gles3" @@ -119,7 +115,7 @@ class TestConfigParsing(object): GL >= 3.0 GL_ARB_ham_sandwhich """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert test.require_extensions == {'GL_ARB_ham_sandwhich'} @@ -131,7 +127,7 @@ class TestConfigParsing(object): GL >= 2.0 GL_ARB_ham_sandwhich """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert test.require_version == 2.0 @@ -143,7 +139,7 @@ class TestConfigParsing(object): GL ES >= 2.0 GL_ARB_ham_sandwhich """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert test.require_version == 2.0 @@ -155,7 +151,7 @@ class TestConfigParsing(object): GL >= 2.1 GLSL >= 1.20 """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert test.require_shader == 1.2 @@ -167,7 +163,7 @@ class TestConfigParsing(object): GL ES >= 2.0 GLSL ES >= 1.00 """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert test.require_shader == 1.0 @@ -187,7 +183,7 @@ class TestConfigParsing(object): GL_MAX_VARYING_COMPONENTS GL_ARB_foobar """)) - test = shader_test.ShaderTest.new(six.text_type(p)) + test = shader_test.ShaderTest.new(str(p)) assert test.require_version == 3.3 assert test.require_shader == 1.50 @@ -205,7 +201,7 @@ class TestCommand(object): GL ES >= 3.0 GLSL ES >= 3.00 es """)) - return six.text_type(p) + return str(p) def test_getter_adds_auto_and_fbo(self, test_file): """test.shader_test.ShaderTest: -auto and -fbo is added to the command. @@ -245,7 +241,7 @@ class TestMultiShaderTest(object): [vertex shader]""")) return shader_test.MultiShaderTest.new( - [six.text_type(one), six.text_type(two)]) + [str(one), str(two)]) def test_prog(self, inst): assert os.path.basename(inst.command[0]) == 'shader_runner' @@ -275,7 +271,7 @@ class TestMultiShaderTest(object): [vertex shader]""")) return shader_test.MultiShaderTest.new( - [six.text_type(one), six.text_type(two)]) + [str(one), str(two)]) def test_resume(self, inst): actual = inst._resume(1) # pylint: disable=protected-access diff --git a/unittests/framework/test_core.py b/unittests/framework/test_core.py index 2873582f5..52ead0c86 100644 --- a/unittests/framework/test_core.py +++ b/unittests/framework/test_core.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,16 +21,12 @@ """ Module providing tests for the core module """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections import errno import os import textwrap import pytest -import six from framework import core from framework import exceptions @@ -58,7 +54,7 @@ class TestParseListfile(object): """ f = tmpdir.join('test.list') f.write("/tmp/foo\n/tmp/bar\n") - results = core.parse_listfile(six.text_type(f)) + results = core.parse_listfile(str(f)) assert isinstance(results, collections.Container) def test_parse_listfile_whitespace(self, tmpdir): @@ -73,7 +69,7 @@ class TestParseListfile(object): space newline """)) - results = core.parse_listfile(six.text_type(f)) + results = core.parse_listfile(str(f)) assert results[0] == 'space between' assert results[1] == 'tab' @@ -96,7 +92,7 @@ class TestParseListfile(object): f = tmpdir.join('test.list') f.write("~/foo\n") - results = core.parse_listfile(six.text_type(f)) + results = core.parse_listfile(str(f)) assert os.path.normpath(results[0]) == expected @@ -111,7 +107,7 @@ class TestGetConfig(object): def test_config_in_xdg_config_home(self, tmpdir, mocker): """core.get_config() finds $XDG_CONFIG_HOME/piglit.conf""" env = mocker.patch('framework.core.os.environ', new={}) - env['XDG_CONFIG_HOME'] = six.text_type(tmpdir) + env['XDG_CONFIG_HOME'] = str(tmpdir) conf = tmpdir.join('piglit.conf') conf.write(self._CONF_FILE) core.get_config() @@ -122,7 +118,7 @@ class TestGetConfig(object): def test_config_in_home_dir(self, tmpdir, mocker): """core.get_config() finds $HOME/.config/piglit.conf""" env = mocker.patch('framework.core.os.environ', new={}) - env['HOME'] = six.text_type(tmpdir) + env['HOME'] = str(tmpdir) conf = tmpdir.join('piglit.conf') conf.write(self._CONF_FILE) core.get_config() @@ -139,7 +135,7 @@ class TestGetConfig(object): try: core.get_config() finally: - os.chdir(six.text_type(ret)) + os.chdir(str(ret)) assert core.PIGLIT_CONFIG.has_section('nose-test') @@ -148,7 +144,7 @@ class TestGetConfig(object): # Mock the __file__ attribute of the core module, since that's how # piglit decides where the root of the piglit directory is. mocker.patch('framework.core.__file__', - six.text_type(tmpdir.join('framework', 'core.py'))) + str(tmpdir.join('framework', 'core.py'))) mocker.patch('framework.core.os.environ', new={}) conf = tmpdir.join('piglit.conf') conf.write(self._CONF_FILE) @@ -258,7 +254,6 @@ class TestCheckDir(object): with pytest.raises(Sentinel): core.check_dir('foo', handler=mocker.Mock(side_effect=Sentinel)) - @skip.PY2 def test_stat_FileNotFoundError(self, mocker, tmpdir): """core.check_dir: FileNotFoundError is raised and failifexsits is False continue.""" diff --git a/unittests/framework/test_dmesg.py b/unittests/framework/test_dmesg.py index 0ebb3ca20..652d36a8a 100644 --- a/unittests/framework/test_dmesg.py +++ b/unittests/framework/test_dmesg.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,9 +26,6 @@ which allows us to test all classes on all platforms, including windows. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections import re try: @@ -37,7 +34,6 @@ except ImportError: from unittest import mock import pytest -import six from framework import dmesg from framework import status @@ -89,7 +85,7 @@ class TestBaseDmesg(object): (status.NOTRUN, status.NOTRUN), (status.TIMEOUT, status.TIMEOUT), ], - ids=six.text_type) + ids=str) def test_update_result_status(self, initial, expected): """Test that when update_result is called status change when they should, and don't when they shouldn't. @@ -109,7 +105,7 @@ class TestBaseDmesg(object): (status.NOTRUN, status.NOTRUN), (status.TIMEOUT, status.TIMEOUT), ], - ids=six.text_type) + ids=str) def test_update_result_subtests(self, initial, expected): """Test that when update_result is called subtest statuses change when they should, and don't when they shouldn't. @@ -194,28 +190,12 @@ class TestLinuxDmesgTimestamps(object): with pytest.warns(RuntimeWarning): dmesg.LinuxDmesg() - @skip.PY3 - def test_config_oserror(self, mocker): - """Test that on python 2.x if an OSError is raised by gzip.open - operation doesn't stop. - """ - self._do_test(OSError, mocker) - - @skip.PY3 - def test_config_ioerror(self, mocker): - """Test that on python 2.x if an IOError is raised by gzip.open - operation doesn't stop. - """ - self._do_test(IOError, mocker) - - @skip.PY2 def test_config_filenotfounderror(self, mocker): """Test that on python 3.x if an FileNotFound is raised by gzip.open operation doesn't stop. """ self._do_test(FileNotFoundError, mocker) - @skip.PY2 def test_config_permissionerror(self, mocker): """Test that on python 3.x if an PermissionError is raised by gzip.open operation doesn't stop. @@ -340,7 +320,7 @@ def _name_get_dmesg(value): """Function that names TestGetDmesg.test_get_dmesg.""" if isinstance(value, bool): return 'real' if not value else 'dummy' - elif isinstance(value, six.text_type): + elif isinstance(value, str): return value elif isinstance(value, dmesg.BaseDmesg): return repr(value) diff --git a/unittests/framework/test_driver_classifier.py b/unittests/framework/test_driver_classifier.py index 801a7ae49..7c2e1032f 100644 --- a/unittests/framework/test_driver_classifier.py +++ b/unittests/framework/test_driver_classifier.py @@ -1,5 +1,6 @@ # coding=utf-8 # Copyright (c) 2016 Broadcom +# Copyright © 2019 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -22,17 +23,12 @@ """Tests for the driver_classifier module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - try: import mock except ImportError: from unittest import mock import pytest -import six from framework import driver_classifier @@ -65,7 +61,7 @@ class TestDriverClassifier(object): # Modern VC4 string ('Gallium 0.4 on VC4 V3D 2.1', ['vc4-2.1', 'vc4', 'mesa']), ], - ids=six.text_type) + ids=str) def test_renderer_categorization(self, renderer, categories): """Test that when given a certain renderer string, the correct @@ -82,5 +78,5 @@ class TestDriverClassifier(object): b'sentinal\nand some other ' b'stuff')): test.collect_glxinfo() - assert isinstance(test.renderer, six.text_type) + assert isinstance(test.renderer, str) assert test.renderer == 'sentinal' diff --git a/unittests/framework/test_exceptions.py b/unittests/framework/test_exceptions.py index a66294b69..6e3ea5e70 100644 --- a/unittests/framework/test_exceptions.py +++ b/unittests/framework/test_exceptions.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Tests for the exceptions module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest from framework import exceptions diff --git a/unittests/framework/test_grouptools.py b/unittests/framework/test_grouptools.py index f9262c755..77d63be66 100644 --- a/unittests/framework/test_grouptools.py +++ b/unittests/framework/test_grouptools.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2014, 2016 Intel Corporation +# Copyright © 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/unittests/framework/test_log.py b/unittests/framework/test_log.py index 2f4b435c8..a9b194d11 100644 --- a/unittests/framework/test_log.py +++ b/unittests/framework/test_log.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,15 +21,12 @@ """Tests for log.py module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import collections +import io import sys import threading import pytest -import six import framework.log as log @@ -75,7 +72,7 @@ class TestQuietLog(object): @pytest.fixture(autouse=True, scope='function') def mock_stdout(self, mocker): - mocker.patch.object(sys, 'stdout', six.StringIO()) + mocker.patch.object(sys, 'stdout', io.StringIO()) def test_log(self, log_state): # pylint: disable=redefined-outer-name """Test the output of the log method.""" @@ -124,7 +121,7 @@ class TestVerboseLog(object): @pytest.fixture(autouse=True, scope='function') def mock_stdout(self, mocker): - mocker.patch.object(sys, 'stdout', six.StringIO()) + mocker.patch.object(sys, 'stdout', io.StringIO()) def test_log(self, log_state): # pylint: disable=redefined-outer-name """Test the output of the log method.""" @@ -169,7 +166,7 @@ class TestDummyLog(object): @pytest.fixture(autouse=True, scope='function') def mock_stdout(self, mocker): - mocker.patch.object(sys, 'stdout', six.StringIO()) + mocker.patch.object(sys, 'stdout', io.StringIO()) def test_log(self, log_state): # pylint: disable=redefined-outer-name """Test the output of the log method.""" diff --git a/unittests/framework/test_monitoring.py b/unittests/framework/test_monitoring.py index dc820f2b6..9500c7e93 100644 --- a/unittests/framework/test_monitoring.py +++ b/unittests/framework/test_monitoring.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2016 Intel Corporation +# Copyright (c) 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -24,12 +24,7 @@ This provides tests for the framework.monitoring modules. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest -import six from framework import exceptions from framework import monitoring @@ -60,7 +55,7 @@ class TestMonitoring(object): p.write(self.init_contents) self.monitoring.add_rule('error_file', 'file', - six.text_type(p), + str(p), self.regex) self.monitoring.update_monitoring() @@ -77,7 +72,7 @@ class TestMonitoring(object): with pytest.raises(exceptions.PiglitFatalError): self.monitoring.add_rule('error_file_bad_type', 'bad_type', - six.text_type(p), + str(p), self.regex) @skip.linux @@ -87,7 +82,7 @@ class TestMonitoring(object): p.write(self.init_contents) self.monitoring.add_rule('error_file', 'file', - six.text_type(p), + str(p), self.regex) self.monitoring.update_monitoring() @@ -103,7 +98,7 @@ class TestMonitoring(object): p.write(self.init_contents) self.monitoring.add_rule('no_error_file', 'file', - six.text_type(p), + str(p), self.regex) self.monitoring.update_monitoring() @@ -119,7 +114,7 @@ class TestMonitoring(object): p.write(self.init_contents) self.monitoring.add_rule('error_locked_file', 'locked_file', - six.text_type(p), + str(p), self.regex) self.monitoring.update_monitoring() @@ -135,7 +130,7 @@ class TestMonitoring(object): p.write(self.init_contents) self.monitoring.add_rule('no_error_file', 'locked_file', - six.text_type(p), + str(p), self.regex) self.monitoring.update_monitoring() diff --git a/unittests/framework/test_options.py b/unittests/framework/test_options.py index 4d070ab88..df392281c 100644 --- a/unittests/framework/test_options.py +++ b/unittests/framework/test_options.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,10 +21,6 @@ """Tests for the options module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework import options # pylint: disable=protected-access diff --git a/unittests/framework/test_profile.py b/unittests/framework/test_profile.py index 8f61b31c9..42aade15b 100644 --- a/unittests/framework/test_profile.py +++ b/unittests/framework/test_profile.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,12 +21,7 @@ """ Provides test for the framework.profile modules """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest -import six from framework import exceptions from framework import grouptools @@ -50,7 +45,7 @@ class TestLoadTestProfile(object): p = tmpdir.join('foo.profile') with pytest.raises(exceptions.PiglitFatalError): - profile.load_test_profile(six.text_type(p)) + profile.load_test_profile(str(p)) def test_no_such_module(self, tmpdir): """profile.load_test_profile: Trying to load a non-existent module @@ -124,7 +119,7 @@ class TestTestDict(object): @pytest.mark.parametrize( "arg", [None, utils.Test(['foo']), ['a'], {'a': 1}], - ids=six.text_type) + ids=str) def test_key_not_string(self, arg): """profile.TestDict: If key value isn't a string an exception is raised. diff --git a/unittests/framework/test_results.py b/unittests/framework/test_results.py index cd7c2423d..414c455a3 100644 --- a/unittests/framework/test_results.py +++ b/unittests/framework/test_results.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright (c) 2014-2016 Intel Corporation +# Copyright (c) 2014-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,12 +21,7 @@ """Tests for the results module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - import pytest -import six from framework import exceptions from framework import grouptools @@ -449,7 +444,7 @@ class TestTotals(object): # The tuple is required because of the timeout status, which conflicts with # the timeout pylint plugin @pytest.mark.parametrize( - "key", ((x, ) for x in six.iterkeys(results.Totals()))) + "key", ((x, ) for x in results.Totals().keys())) def test_totals_true(self, key): """bool() returns True when any value is not 0.""" test = results.Totals() @@ -541,7 +536,7 @@ class TestTestrunResult(object): def test_totals(self, inst): """totals is restored correctly.""" baseline = shared.JSON['totals'].copy() - for s in six.itervalues(baseline): + for s in baseline.values(): del s['__type__'] assert baseline == dict(inst.totals) diff --git a/unittests/framework/test_status.py b/unittests/framework/test_status.py index 94f805a23..d4fc9d9a0 100644 --- a/unittests/framework/test_status.py +++ b/unittests/framework/test_status.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2014, 2016 Intel Corporation +# Copyright © 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -27,13 +27,9 @@ just asserts that the regressions, fixes, etc lists are as expected. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools import pytest -import six from framework import status @@ -127,8 +123,8 @@ def test_no_change(new, old): @pytest.mark.parametrize("stat,op,expected", [ - (status.Status('Test', 0, (0, 0)), six.text_type, 'Test'), - (status.Status('Test', 0, (0, 0)), six.binary_type, b'Test'), + (status.Status('Test', 0, (0, 0)), str, 'Test'), + (status.Status('Test', 0, (0, 0)), bytes, b'Test'), (status.Status('Test', 0, (0, 0)), int, 0), (status.Status('Test', 0, (0, 0)), repr, 'Status("Test", 0, (0, 0))'), (status.Status('Test', 0, (0, 0)), hash, hash('Test')), diff --git a/unittests/framework/test_wflinfo.py b/unittests/framework/test_wflinfo.py index 73450670d..13d4de439 100644 --- a/unittests/framework/test_wflinfo.py +++ b/unittests/framework/test_wflinfo.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,9 +21,6 @@ """Test the wflinfo module.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import subprocess import textwrap try: diff --git a/unittests/framework/utils.py b/unittests/framework/utils.py index 15117f97d..344d88795 100644 --- a/unittests/framework/utils.py +++ b/unittests/framework/utils.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2016 Intel Corporation +# Copyright © 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -24,10 +24,6 @@ This is only piglit specific data and functions. """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) - from framework.test.base import Test as _Test diff --git a/unittests/generators/test_generators.py b/unittests/generators/test_generators.py index e2a7c7fd4..191f2e0a0 100644 --- a/unittests/generators/test_generators.py +++ b/unittests/generators/test_generators.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -27,9 +27,6 @@ Tests that take more than ~10 seconds should be marked as "slow" and tests that take more than ~30 seconds should be marked as "very_slow". """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import importlib try: import mock @@ -82,7 +79,7 @@ import pytest ]) def test_generators(name, tmpdir): """Teat each generator.""" - mod = importlib.import_module(name) + mod = importlib.import_module('generated_tests.' + name) tmpdir.chdir() # Some tests do checks for sys.argv, so mock that out. Also mock out diff --git a/unittests/generators/test_glsl.py b/unittests/generators/test_glsl.py index 5eec79484..4ec1f1f08 100644 --- a/unittests/generators/test_glsl.py +++ b/unittests/generators/test_glsl.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2016 Intel Corporation +# Copyright © 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,17 +21,13 @@ """Tests for generated_tests/modules/glsl.py.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools import operator import pytest -import six # pylint can't figure out the sys.path manipulation. -from modules import glsl # pylint: disable=import-error +from generated_tests.modules import glsl # pylint: disable=import-error # pylint: disable=no-self-use,invalid-name @@ -151,12 +147,12 @@ def test_compare_glsles_to_float(op, first, second): def test_GLSLVersion_str(): """generated_tests.modules.glsl.GLSLVersion: str()""" - assert six.text_type(glsl.Version('110')) == '110' + assert str(glsl.Version('110')) == '110' def test_GLSLESVersion_str(): """generated_tests.modules.glsl.GLSLESVersion: str()""" - assert six.text_type(glsl.Version('100')) == '100' + assert str(glsl.Version('100')) == '100' def test_GLSLVersion_int(): diff --git a/unittests/generators/test_types.py b/unittests/generators/test_types.py index 39c92d0d9..c713d2ffe 100644 --- a/unittests/generators/test_types.py +++ b/unittests/generators/test_types.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2016 Intel Corporation +# Copyright © 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,15 +21,12 @@ """Tests from generated_tests/modules/types.py""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import itertools import pytest # pylint can't figure out the sys.path manipulation. -from modules import types # pylint: disable=import-error,wrong-import-order +from generated_tests.modules import types # pylint: disable=import-error,wrong-import-order def test_container_is_type_assert(): diff --git a/unittests/suites/test_integration.py b/unittests/suites/test_integration.py index 35bbb16d8..29528cbcb 100644 --- a/unittests/suites/test_integration.py +++ b/unittests/suites/test_integration.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014, 2016 Intel Corporation +# Copyright (c) 2014, 2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,9 +26,6 @@ is mainly just a sanity check to make sure the modules don't contain syntax errors and to ensure that the API hasn't changed without fixing these modules """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import importlib import pytest diff --git a/unittests/suites/test_native.py b/unittests/suites/test_native.py index a391dd5e8..b5a2e668b 100644 --- a/unittests/suites/test_native.py +++ b/unittests/suites/test_native.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2014 Intel Corporation +# Copyright (c) 2014, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,9 +26,6 @@ it does not provide tests for non native tests that use piglit (oglconfrom, etc) """ -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) import importlib import os.path diff --git a/unittests/suites/test_oglconform.py b/unittests/suites/test_oglconform.py index 2cce1796c..7d57ca5d2 100644 --- a/unittests/suites/test_oglconform.py +++ b/unittests/suites/test_oglconform.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2015-2016 Intel Corporation +# Copyright (c) 2015-2016, 2019 Intel Corporation # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,16 +21,13 @@ """Tests for the oglconform integration.""" -from __future__ import ( - absolute_import, division, print_function, unicode_literals -) +import io try: import mock except ImportError: from unittest import mock import pytest -from six.moves import cStringIO as StringIO from framework import grouptools from framework import status @@ -48,7 +45,7 @@ class TestMakeProfile(object): def test_basic(self, mocker): """tests.oglconform._make_profile: Adds test names""" - io_ = mocker.Mock(wraps=StringIO(u'group test.name\n')) + io_ = mocker.Mock(wraps=io.StringIO(u'group test.name\n')) io_.name = mocker.Mock() mock_file = mocker.MagicMock() @@ -66,7 +63,7 @@ class TestMakeProfile(object): def test_missing(self, mocker): """tests.oglconform._make_profile: handles missing groups""" - io_ = mocker.Mock(wraps=StringIO(u'test.name\n')) + io_ = mocker.Mock(wraps=io.StringIO(u'test.name\n')) io_.name = mocker.Mock() mock_file = mocker.MagicMock() |