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 /framework/test | |
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>
Diffstat (limited to 'framework/test')
-rw-r--r-- | framework/test/__init__.py | 6 | ||||
-rw-r--r-- | framework/test/base.py | 4 | ||||
-rw-r--r-- | framework/test/deqp.py | 6 | ||||
-rw-r--r-- | framework/test/gleantest.py | 4 | ||||
-rw-r--r-- | framework/test/glsl_parser_test.py | 4 | ||||
-rw-r--r-- | framework/test/gtest.py | 5 | ||||
-rw-r--r-- | framework/test/oclconform.py | 5 | ||||
-rw-r--r-- | framework/test/opencv.py | 5 | ||||
-rw-r--r-- | framework/test/opengl.py | 6 | ||||
-rw-r--r-- | framework/test/piglit_test.py | 4 | ||||
-rw-r--r-- | framework/test/shader_test.py | 13 |
11 files changed, 46 insertions, 16 deletions
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: |