diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2016-01-12 16:01:02 -0800 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2016-02-08 12:29:34 -0800 |
commit | 60d848ed60997352e3ce375974a8202784261488 (patch) | |
tree | 4be70964d9d80911c0e8595272de75f28d3629c3 | |
parent | a0cb4ea9c28acf664e90a755ee4a48c9c21032ed (diff) |
framework,unittests: use __future__ unicode_literals
Use unicode_literals from __future__. This makes undecorated strings
(those not using and b or u prefix) into unicode instead of bytes in
python 2. This means that bytes strings need to have a b prefix now.
This also fixes a couple of unittests that broke during the transition.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
87 files changed, 312 insertions, 107 deletions
diff --git a/framework/backends/__init__.py b/framework/backends/__init__.py index 48c791716..78213755f 100644 --- a/framework/backends/__init__.py +++ b/framework/backends/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014, 2015 Intel Corporation +# Copyright (c) 2014-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 @@ -41,7 +41,9 @@ that a user actually wants. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import importlib diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py index c0c890335..b5b485842 100644 --- a/framework/backends/abstract.py +++ b/framework/backends/abstract.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014 Intel Corporation +# Copyright (c) 2014, 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 @@ -25,7 +25,9 @@ This module provides mixins and base classes for backend modules. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import abc import contextlib import itertools diff --git a/framework/backends/compression.py b/framework/backends/compression.py index 420c06815..a1b9adefc 100644 --- a/framework/backends/compression.py +++ b/framework/backends/compression.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-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 @@ -37,7 +37,9 @@ the best way to get a compressor. """ -from __future__ import print_function, absolute_import, division +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import bz2 import errno import functools diff --git a/framework/backends/json.py b/framework/backends/json.py index 88702e86f..beae8f883 100644 --- a/framework/backends/json.py +++ b/framework/backends/json.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014 Intel Corporation +# Copyright (c) 2014,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 @@ -20,7 +20,9 @@ """ Module providing json backend for piglit """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import sys import shutil diff --git a/framework/backends/junit.py b/framework/backends/junit.py index cf48b40ae..062c0615e 100644 --- a/framework/backends/junit.py +++ b/framework/backends/junit.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014, 2015 Intel Corporation +# Copyright (c) 2014-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 @@ -20,7 +20,9 @@ """ Module implementing a JUnitBackend for piglit """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os.path import shutil diff --git a/framework/backends/register.py b/framework/backends/register.py index fc3e79b55..8d30d3e7b 100644 --- a/framework/backends/register.py +++ b/framework/backends/register.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-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 @@ -20,7 +20,9 @@ """An object for registering backends.""" -from __future__ import absolute_import, division, print_function +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 index 8369c0e54..3c8e49009 100644 --- a/framework/compat.py +++ b/framework/compat.py @@ -24,7 +24,9 @@ This function is pending upstreaming in six. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import six diff --git a/framework/core.py b/framework/core.py index fbe7377f3..5ef72cb65 100644 --- a/framework/core.py +++ b/framework/core.py @@ -22,7 +22,9 @@ # Piglit core -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import errno import os import subprocess diff --git a/framework/dmesg.py b/framework/dmesg.py index c33dd1166..7bf18d18e 100644 --- a/framework/dmesg.py +++ b/framework/dmesg.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2014 Intel Corporation +# Copyright (c) 2013-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"), @@ -35,7 +35,9 @@ dmesg implementation for their OS. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import abc import gzip import re @@ -145,7 +147,7 @@ class BaseDmesg(object): result.subtests[key] = replace(value) # Add the dmesg values to the result - result.dmesg = "\n".join(self._new_messages) + result.dmesg = "\n".join(self._new_messages).decode('utf-8') return result @@ -172,9 +174,9 @@ class LinuxDmesg(BaseDmesg): # First check to see if we can find the live kernel config. try: - with gzip.open("/proc/config.gz", 'r') as f: + with gzip.open(b"/proc/config.gz", 'r') as f: for line in f: - if line.startswith("CONFIG_PRINTK_TIME=y"): + if line.startswith(b"CONFIG_PRINTK_TIME=y"): return # If there is a malformed or missing file, just ignore it and try the # regex match (which may not exist if dmesg ringbuffer was cleared). diff --git a/framework/grouptools.py b/framework/grouptools.py index 9d16c2cbc..c3761c766 100644 --- a/framework/grouptools.py +++ b/framework/grouptools.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014, 2015 Intel Corporation +# Copyright (c) 2014-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 @@ -29,7 +29,9 @@ posix paths they may not start with a leading '/'. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import six from six.moves import zip diff --git a/framework/log.py b/framework/log.py index 12ff7ca1a..cd6cdc58c 100644 --- a/framework/log.py +++ b/framework/log.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013 Intel Corporation +# Copyright (c) 2013-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"), @@ -26,7 +26,9 @@ returning BaseLog derived instances to individual tests. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import sys import abc import itertools diff --git a/framework/options.py b/framework/options.py index 78a020f74..cf49520d9 100644 --- a/framework/options.py +++ b/framework/options.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-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 @@ -25,7 +25,9 @@ is that while you can mutate """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import collections import os import re diff --git a/framework/profile.py b/framework/profile.py index 4ab39c0a5..fc38c56e1 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -26,7 +26,9 @@ are represented by a TestProfile or a TestProfile derived object. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import multiprocessing import multiprocessing.dummy diff --git a/framework/programs/parsers.py b/framework/programs/parsers.py index 572ac1870..9e1d1e3bd 100644 --- a/framework/programs/parsers.py +++ b/framework/programs/parsers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-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 @@ -27,7 +27,9 @@ argumetns early and acting on them, or by inheriting from a parent object. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import argparse from framework import core diff --git a/framework/programs/run.py b/framework/programs/run.py index 3bad41aa6..49f7b11ac 100644 --- a/framework/programs/run.py +++ b/framework/programs/run.py @@ -19,7 +19,9 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import argparse import sys import os diff --git a/framework/programs/summary.py b/framework/programs/summary.py index 4137cf308..949c62882 100644 --- a/framework/programs/summary.py +++ b/framework/programs/summary.py @@ -19,7 +19,9 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import argparse import shutil import os diff --git a/framework/results.py b/framework/results.py index b18dce56d..3bc536335 100644 --- a/framework/results.py +++ b/framework/results.py @@ -21,7 +21,9 @@ """ Module for results generation """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import collections import copy import datetime diff --git a/framework/status.py b/framework/status.py index 665c972ad..4c8b421f7 100644 --- a/framework/status.py +++ b/framework/status.py @@ -56,7 +56,9 @@ The formula for determining fixes is: """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import six diff --git a/framework/summary/__init__.py b/framework/summary/__init__.py index 0f0f144f0..e24b26890 100644 --- a/framework/summary/__init__.py +++ b/framework/summary/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-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 @@ -24,6 +24,8 @@ # generator functions up, allow for better testing coverage. Then we import the # public parts here, so that we have a nice interface to work with. -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) from .html_ import html, feat from .console_ import console diff --git a/framework/summary/common.py b/framework/summary/common.py index e5e670b89..364f3e04d 100644 --- a/framework/summary/common.py +++ b/framework/summary/common.py @@ -1,4 +1,4 @@ -# Copyright 2013-2015 Intel Corporation +# Copyright 2013-2016 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices # Copyright 2014 VMWare @@ -22,7 +22,9 @@ """Shared functions for summary generation.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import re import operator diff --git a/framework/summary/console_.py b/framework/summary/console_.py index b3945d4d8..e17a1d8c1 100644 --- a/framework/summary/console_.py +++ b/framework/summary/console_.py @@ -1,4 +1,4 @@ -# Copyright 2013-2015 Intel Corporation +# Copyright 2013-2016 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices # Copyright 2014 VMWare @@ -22,7 +22,9 @@ """Generate text summaries to be printed to the console.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import textwrap import six diff --git a/framework/summary/feature.py b/framework/summary/feature.py index 2fb8f50e3..7298cff51 100644 --- a/framework/summary/feature.py +++ b/framework/summary/feature.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-2016 Intel Corporation # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -21,7 +21,9 @@ # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -from __future__ import print_function, division, absolute_import +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import copy diff --git a/framework/summary/html_.py b/framework/summary/html_.py index d36920456..d89ae97ae 100644 --- a/framework/summary/html_.py +++ b/framework/summary/html_.py @@ -1,4 +1,4 @@ -# Copyright 2013-2015 Intel Corporation +# Copyright 2013-2016 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices # Copyright 2014 VMWare @@ -22,7 +22,9 @@ """Genrate html summaries.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import shutil import tempfile diff --git a/framework/test/__init__.py b/framework/test/__init__.py index 1d1836420..edb4d3e03 100644 --- a/framework/test/__init__.py +++ b/framework/test/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014 Intel Corporation +# Copyright (c) 2014,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 @@ -24,7 +24,9 @@ # 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 +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) from .base import * from .piglit_test import * from .gleantest import * diff --git a/framework/test/base.py b/framework/test/base.py index f65a839f0..159ab50d4 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -22,7 +22,9 @@ """ Module provides a base class for Tests """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import errno import os import time diff --git a/framework/test/deqp.py b/framework/test/deqp.py index bfe228e41..0c4b8a04d 100644 --- a/framework/test/deqp.py +++ b/framework/test/deqp.py @@ -1,4 +1,4 @@ -# Copyright 2014, 2015 Intel Corporation +# Copyright 2014-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 @@ -18,7 +18,9 @@ # 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 +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import abc import os import subprocess diff --git a/framework/test/gleantest.py b/framework/test/gleantest.py index a12b2aded..3d0c2efbd 100644 --- a/framework/test/gleantest.py +++ b/framework/test/gleantest.py @@ -22,7 +22,9 @@ """ Glean support """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os from framework import options diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py index da223fbf3..73224c691 100644 --- a/framework/test/glsl_parser_test.py +++ b/framework/test/glsl_parser_test.py @@ -21,7 +21,9 @@ """ This module enables the running of GLSL parser tests. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import re diff --git a/framework/test/gtest.py b/framework/test/gtest.py index 547f92a2f..b331a2fb3 100644 --- a/framework/test/gtest.py +++ b/framework/test/gtest.py @@ -1,3 +1,4 @@ +# Copyright 2016 Intel Corporation # Copyright 2013, 2014 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -22,7 +23,9 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # -from __future__ import absolute_import, division, print_function +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 8a652f7c4..48e4b72ab 100644 --- a/framework/test/oclconform.py +++ b/framework/test/oclconform.py @@ -1,3 +1,4 @@ +# Copyright 2016 Intel Corporation # Copyright 2014 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -22,7 +23,9 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # -from __future__ import absolute_import, division, print_function +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 bb8621ba1..3b9a12e43 100644 --- a/framework/test/opencv.py +++ b/framework/test/opencv.py @@ -1,3 +1,4 @@ +# Copyright 2016 Intel Corporation # Copyright 2014 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -22,7 +23,9 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # -from __future__ import absolute_import, division, print_function +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 af0cc560b..755e3e3f4 100644 --- a/framework/test/opengl.py +++ b/framework/test/opengl.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Intel Corporation +# Copyright (c) 2015-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 @@ -20,7 +20,9 @@ """Mixins for OpenGL derived tests.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import errno import os import subprocess diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py index 998a4eed0..32a991b1a 100644 --- a/framework/test/piglit_test.py +++ b/framework/test/piglit_test.py @@ -22,7 +22,9 @@ """ Module provides a base class for Tests """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import sys import glob diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py index c96b4a7fa..f5c26baba 100644 --- a/framework/test/shader_test.py +++ b/framework/test/shader_test.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012, 2014, 2015 Intel Corporation +# Copyright (C) 2012, 2014-2016 Intel Corporation # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -23,9 +23,13 @@ """ This module enables running shader tests. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import re +import six + from framework import exceptions from .opengl import FastSkipMixin from .piglit_test import PiglitBaseTest @@ -57,7 +61,10 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest): # an exception. The second looks for the GL version or raises an # exception with open(filename, 'r') as shader_file: - lines = (l for l in shader_file.readlines()) + if six.PY3: + lines = (l for l in shader_file.readlines()) + elif six.PY2: + lines = (l.decode('utf-8') for l in shader_file.readlines()) # Find the config section for line in lines: diff --git a/registry/gl.py b/registry/gl.py index 98b1ee333..078261ed3 100644 --- a/registry/gl.py +++ b/registry/gl.py @@ -23,7 +23,9 @@ Parse gl.xml into Python objects. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os.path import re @@ -182,7 +184,7 @@ class OrderedKeyedSet(object): # pair has form {key: [prev, next, key, value])}. self.__map = dict() - if isinstance(key, str): + if isinstance(key, six.text_type): self.__key_func = lambda elem: getattr(elem, key) else: self.__key_func = key diff --git a/tests/all.py b/tests/all.py index 260f62da5..1650d8fe8 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- # All tests that come with piglit, using default settings -from __future__ import print_function, division, absolute_import +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import itertools import os import platform diff --git a/tests/cl.py b/tests/cl.py index 7740dfd8e..6679930d4 100644 --- a/tests/cl.py +++ b/tests/cl.py @@ -7,7 +7,9 @@ # invalid constant names, they're not really fixable, so just hide them. # pylint: disable=invalid-name -from __future__ import division, absolute_import, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os diff --git a/tests/cpu.py b/tests/cpu.py index d3f9f886d..34fb6f8ff 100644 --- a/tests/cpu.py +++ b/tests/cpu.py @@ -10,6 +10,9 @@ hardware. """ +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) from tests.quick import profile from framework.test import GLSLParserTest diff --git a/tests/cts.py b/tests/cts.py index 9250e0ad9..550eb2971 100644 --- a/tests/cts.py +++ b/tests/cts.py @@ -42,7 +42,9 @@ PIGLIT_CTS_EXTRA_ARGS -- environment equivalent of [cts]:extra_args """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import itertools from framework.test import deqp diff --git a/tests/deqp_gles2.py b/tests/deqp_gles2.py index c4bacb284..c951a199a 100644 --- a/tests/deqp_gles2.py +++ b/tests/deqp_gles2.py @@ -20,6 +20,10 @@ """Piglit integrations for dEQP GLES2 tests.""" +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from framework.test import deqp __all__ = ['profile'] diff --git a/tests/deqp_gles3.py b/tests/deqp_gles3.py index d35389993..00b06ad3e 100644 --- a/tests/deqp_gles3.py +++ b/tests/deqp_gles3.py @@ -20,6 +20,10 @@ """Piglit integrations for dEQP GLES3 tests.""" +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + import xml.etree.cElementTree as ET from framework.test import deqp diff --git a/tests/deqp_gles31.py b/tests/deqp_gles31.py index 8b48f5ae4..e5a22e096 100644 --- a/tests/deqp_gles31.py +++ b/tests/deqp_gles31.py @@ -20,6 +20,10 @@ """Piglit integrations for dEQP GLES31 tests.""" +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from framework.test import deqp __all__ = ['profile'] diff --git a/tests/es3conform.py b/tests/es3conform.py index 53c2fc407..6bdcf2ba9 100644 --- a/tests/es3conform.py +++ b/tests/es3conform.py @@ -20,6 +20,10 @@ # 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 re from os import path diff --git a/tests/glslparser.py b/tests/glslparser.py index b5338f87d..60442a2a4 100644 --- a/tests/glslparser.py +++ b/tests/glslparser.py @@ -1,5 +1,9 @@ """A profile that runs only GLSLParserTest instances.""" +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from framework.test import GLSLParserTest from tests.all import profile diff --git a/tests/gpu.py b/tests/gpu.py index 8844bb63e..01bca2584 100644 --- a/tests/gpu.py +++ b/tests/gpu.py @@ -2,6 +2,10 @@ # quick.tests minus compiler tests. +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from tests.quick import profile from framework.test import GLSLParserTest diff --git a/tests/igt.py b/tests/igt.py index 074df08cc..7ebb03646 100644 --- a/tests/igt.py +++ b/tests/igt.py @@ -32,7 +32,10 @@ drm. Even if you have rendernode support enabled. """ -from __future__ import print_function, division, absolute_import +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + import os import re import subprocess diff --git a/tests/llvmpipe.py b/tests/llvmpipe.py index beb4511fd..6dd7a9024 100644 --- a/tests/llvmpipe.py +++ b/tests/llvmpipe.py @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + import platform import sys diff --git a/tests/oglconform.py b/tests/oglconform.py index cdf42af75..5104f442b 100644 --- a/tests/oglconform.py +++ b/tests/oglconform.py @@ -21,6 +21,9 @@ # 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/quick.py b/tests/quick.py index e97d858c8..0e02f927b 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from framework import grouptools from framework.test import (GleanTest, PiglitGLTest) from tests.all import profile diff --git a/tests/quick_cl.py b/tests/quick_cl.py index 7f82a8619..9f7c8f3ab 100644 --- a/tests/quick_cl.py +++ b/tests/quick_cl.py @@ -24,6 +24,10 @@ # Authors: Tom Stellard <thomas.stellard@amd.com> # +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from tests.cl import profile from framework.test import add_opencv_tests, add_oclconform_tests diff --git a/tests/sanity.py b/tests/sanity.py index 93a884d5c..8c2151ea3 100644 --- a/tests/sanity.py +++ b/tests/sanity.py @@ -2,6 +2,10 @@ # Minimal tests to check whether the installation is working # +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from framework import grouptools from framework.profile import TestProfile from framework.test import PiglitGLTest diff --git a/tests/shader.py b/tests/shader.py index 4be504b02..452f36acb 100644 --- a/tests/shader.py +++ b/tests/shader.py @@ -1,5 +1,9 @@ """A profile that runs only ShaderTest instances.""" +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) + from framework.test import ShaderTest from tests.all import profile diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py index a4dbf24de..8031e9acd 100644 --- a/tests/util/gen_dispatch.py +++ b/tests/util/gen_dispatch.py @@ -24,7 +24,9 @@ Generate C source code from Khronos XML. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import argparse import os.path diff --git a/tests/xts-render.py b/tests/xts-render.py index fb4e943f4..ee644be3c 100644 --- a/tests/xts-render.py +++ b/tests/xts-render.py @@ -19,6 +19,9 @@ # 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 framework import core from framework.profile import load_test_profile diff --git a/tests/xts.py b/tests/xts.py index 6798e70fe..6062c39a6 100644 --- a/tests/xts.py +++ b/tests/xts.py @@ -23,7 +23,9 @@ """ Test integreation for the X Test Suite """ -from __future__ import print_function, division, absolute_import +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import re import subprocess diff --git a/unittests/backends_tests.py b/unittests/backends_tests.py index a7af79580..c3cda86c2 100644 --- a/unittests/backends_tests.py +++ b/unittests/backends_tests.py @@ -22,7 +22,9 @@ """ Tests for the backend package """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import nose.tools as nt diff --git a/unittests/base_tests.py b/unittests/base_tests.py index 2fa13caa6..2e646622a 100644 --- a/unittests/base_tests.py +++ b/unittests/base_tests.py @@ -20,7 +20,9 @@ """ Tests for the exectest module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import tempfile import textwrap import os diff --git a/unittests/compressed_backend_tests.py b/unittests/compressed_backend_tests.py index 3e1582e7f..19eea24bf 100644 --- a/unittests/compressed_backend_tests.py +++ b/unittests/compressed_backend_tests.py @@ -25,7 +25,9 @@ aiming to verify that compression and decompression works as expected. """ -from __future__ import print_function, absolute_import, division +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import functools diff --git a/unittests/core_tests.py b/unittests/core_tests.py index 7f6e52064..9109be2dc 100644 --- a/unittests/core_tests.py +++ b/unittests/core_tests.py @@ -20,7 +20,9 @@ """ Module providing tests for the core module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import collections import functools import os diff --git a/unittests/deqp_tests.py b/unittests/deqp_tests.py index ea0a0162d..7143da29e 100644 --- a/unittests/deqp_tests.py +++ b/unittests/deqp_tests.py @@ -25,7 +25,9 @@ tests """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) try: from unittest import mock diff --git a/unittests/dmesg_tests.py b/unittests/dmesg_tests.py index e6ea4cc53..9cef57f40 100644 --- a/unittests/dmesg_tests.py +++ b/unittests/dmesg_tests.py @@ -25,7 +25,9 @@ which allows us to test all classes on all platforms, including windows. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import re import warnings diff --git a/unittests/exceptions_tests.py b/unittests/exceptions_tests.py index e93d7f744..72d39b88a 100644 --- a/unittests/exceptions_tests.py +++ b/unittests/exceptions_tests.py @@ -20,7 +20,9 @@ """Tests for the exceptions module.""" -from __future__ import print_function, absolute_import, division +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import nose.tools as nt diff --git a/unittests/gleantest_tests.py b/unittests/gleantest_tests.py index b597d692b..e0e39026f 100644 --- a/unittests/gleantest_tests.py +++ b/unittests/gleantest_tests.py @@ -20,7 +20,9 @@ """ Tests for the glean class. Requires Nose """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) try: from unittest import mock diff --git a/unittests/glsl_parser_test_tests.py b/unittests/glsl_parser_test_tests.py index 818090eee..de00d1195 100644 --- a/unittests/glsl_parser_test_tests.py +++ b/unittests/glsl_parser_test_tests.py @@ -20,7 +20,9 @@ """ Provides tests for the shader_test module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import textwrap diff --git a/unittests/grouptools_tests.py b/unittests/grouptools_tests.py index 30d040428..3a3b2d033 100644 --- a/unittests/grouptools_tests.py +++ b/unittests/grouptools_tests.py @@ -20,7 +20,9 @@ """Module with tests for grouptools.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import nose.tools as nt diff --git a/unittests/gtest_tests.py b/unittests/gtest_tests.py index 43977aa9f..568d6493a 100644 --- a/unittests/gtest_tests.py +++ b/unittests/gtest_tests.py @@ -20,7 +20,9 @@ """ Module providing tests for gtest """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import nose.tools as nt diff --git a/unittests/integration_tests.py b/unittests/integration_tests.py index 596fc54b2..1b0cb19ca 100644 --- a/unittests/integration_tests.py +++ b/unittests/integration_tests.py @@ -26,7 +26,9 @@ errors and to ensure that the API hasn't changed without fixing these modules """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import importlib from nose.plugins.skip import SkipTest diff --git a/unittests/json_backend_tests.py b/unittests/json_backend_tests.py index 30a45f771..eb76bfb46 100644 --- a/unittests/json_backend_tests.py +++ b/unittests/json_backend_tests.py @@ -22,7 +22,9 @@ """ Tests for the backend package """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os try: diff --git a/unittests/json_results_update_tests.py b/unittests/json_results_update_tests.py index 85c2d0607..0fcf1ecbf 100644 --- a/unittests/json_results_update_tests.py +++ b/unittests/json_results_update_tests.py @@ -20,7 +20,9 @@ """Tests for JSON backend version updates.""" -from __future__ import print_function, absolute_import, division +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import copy import tempfile diff --git a/unittests/json_tests.py b/unittests/json_tests.py index e1cd4182f..189d246a9 100644 --- a/unittests/json_tests.py +++ b/unittests/json_tests.py @@ -26,7 +26,9 @@ tests and they will change with each version of the json output. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import nose.tools as nt diff --git a/unittests/junit_backends_tests.py b/unittests/junit_backends_tests.py index fda76b2a1..50fb05863 100644 --- a/unittests/junit_backends_tests.py +++ b/unittests/junit_backends_tests.py @@ -22,7 +22,9 @@ """ Tests for the backend package """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os try: diff --git a/unittests/log_tests.py b/unittests/log_tests.py index 5c7a8ba90..63aae5e5e 100644 --- a/unittests/log_tests.py +++ b/unittests/log_tests.py @@ -20,7 +20,9 @@ """ Module provides tests for log.py module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import sys import collections import threading diff --git a/unittests/oglconform_tests.py b/unittests/oglconform_tests.py index a2f2689d9..bcc6eae85 100644 --- a/unittests/oglconform_tests.py +++ b/unittests/oglconform_tests.py @@ -20,7 +20,9 @@ """Tests for the oglconform integration.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) try: from unittest import mock diff --git a/unittests/opencv_tests.py b/unittests/opencv_tests.py index 94167ff68..b533f2b28 100644 --- a/unittests/opencv_tests.py +++ b/unittests/opencv_tests.py @@ -20,7 +20,9 @@ """ Module for testing opencv """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) from . import utils from framework.test import OpenCVTest diff --git a/unittests/opengl_tests.py b/unittests/opengl_tests.py index 4e6656d5d..a6b81c3e4 100644 --- a/unittests/opengl_tests.py +++ b/unittests/opengl_tests.py @@ -20,7 +20,9 @@ """Test the opengl module.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import subprocess import textwrap diff --git a/unittests/options_tests.py b/unittests/options_tests.py index ffe8e376a..3d4761011 100644 --- a/unittests/options_tests.py +++ b/unittests/options_tests.py @@ -20,7 +20,9 @@ """Tests for the options module.""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import re try: diff --git a/unittests/piglit_test_tests.py b/unittests/piglit_test_tests.py index 6352a015f..a882e8d28 100644 --- a/unittests/piglit_test_tests.py +++ b/unittests/piglit_test_tests.py @@ -20,7 +20,9 @@ """Tests for the piglit_test module""" -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) try: from unittest import mock diff --git a/unittests/profile_tests.py b/unittests/profile_tests.py index ee48c1b69..6abbae56d 100644 --- a/unittests/profile_tests.py +++ b/unittests/profile_tests.py @@ -20,7 +20,9 @@ """ Provides test for the framework.profile modules """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import sys import copy diff --git a/unittests/results_tests.py b/unittests/results_tests.py index dc004d5f5..2f5c44047 100644 --- a/unittests/results_tests.py +++ b/unittests/results_tests.py @@ -20,7 +20,9 @@ """ Module providing tests for the core module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import nose.tools as nt import six @@ -383,20 +385,17 @@ class TestStringDescriptor(object): """results.StringDescriptor.__get__: returns default when unset""" nt.eq_(self.test.val, u'') + @nt.raises(TypeError) def test_set_no_replace(self): """results.StringDescriptor.__set__: instance is not replaced - This test might not make sense if you don't understand the difference - between 'is' and '==' in python. '==' is an equavalency test, while - 'is' returns true only if the instances are the same. - - What this test does is makes sure that self.test.val is not *replaced* - by inst, and instead the value is passed into the __set__ method. + This works by setting the value to a valid value (either bytes or str) + and then trying to set it to an invalid value (int). If the assignment + succeeds then the instance has been replaced, if not, it hasn't. """ - inst = 'foo' - self.test.val = inst - nt.ok_(self.test.val is not inst) + self.test.val = 'foo' + self.test.val = 1 def test_set_unicode(self): """results.StringDescriptor.__set__: unicode is stored directly""" diff --git a/unittests/run_parser_tests.py b/unittests/run_parser_tests.py index bce818906..44a123548 100644 --- a/unittests/run_parser_tests.py +++ b/unittests/run_parser_tests.py @@ -20,7 +20,9 @@ """ Module of tests for the run commandline parser """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import sys import os import shutil diff --git a/unittests/shader_test_tests.py b/unittests/shader_test_tests.py index b176b6f17..8d6751139 100644 --- a/unittests/shader_test_tests.py +++ b/unittests/shader_test_tests.py @@ -20,7 +20,9 @@ """ Provides tests for the shader_test module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os try: diff --git a/unittests/status_tests.py b/unittests/status_tests.py index f1ba96d81..b76d5b506 100644 --- a/unittests/status_tests.py +++ b/unittests/status_tests.py @@ -25,7 +25,9 @@ etc """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import itertools import nose.tools as nt diff --git a/unittests/summary_common_tests.py b/unittests/summary_common_tests.py index 041961fdf..cfc9bebaf 100644 --- a/unittests/summary_common_tests.py +++ b/unittests/summary_common_tests.py @@ -21,7 +21,9 @@ """ Module providing tests for the summary module """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import datetime import nose.tools as nt diff --git a/unittests/summary_console_tests.py b/unittests/summary_console_tests.py index 5b097f161..2bca7e4a7 100644 --- a/unittests/summary_console_tests.py +++ b/unittests/summary_console_tests.py @@ -27,7 +27,9 @@ generator. # pylint: disable=protected-access,invalid-name -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import sys import nose.tools as nt diff --git a/unittests/summary_html_tests.py b/unittests/summary_html_tests.py index 523ab39fa..60de10fac 100644 --- a/unittests/summary_html_tests.py +++ b/unittests/summary_html_tests.py @@ -22,7 +22,9 @@ # pylint: disable=protected-access -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import nose.tools as nt diff --git a/unittests/test_lists.py b/unittests/test_lists.py index f56f97962..cf5bdda70 100644 --- a/unittests/test_lists.py +++ b/unittests/test_lists.py @@ -26,7 +26,9 @@ es3conform, etc) """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import importlib import os.path as path diff --git a/unittests/utils.py b/unittests/utils.py index 4e78ba029..f3834ef41 100644 --- a/unittests/utils.py +++ b/unittests/utils.py @@ -25,7 +25,9 @@ in a single place. """ -from __future__ import absolute_import, division, print_function +from __future__ import ( + absolute_import, division, print_function, unicode_literals +) import os import sys import copy |