summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-01-12 16:01:02 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2016-02-08 12:29:34 -0800
commit60d848ed60997352e3ce375974a8202784261488 (patch)
tree4be70964d9d80911c0e8595272de75f28d3629c3 /unittests
parenta0cb4ea9c28acf664e90a755ee4a48c9c21032ed (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 'unittests')
-rw-r--r--unittests/backends_tests.py4
-rw-r--r--unittests/base_tests.py4
-rw-r--r--unittests/compressed_backend_tests.py4
-rw-r--r--unittests/core_tests.py4
-rw-r--r--unittests/deqp_tests.py4
-rw-r--r--unittests/dmesg_tests.py4
-rw-r--r--unittests/exceptions_tests.py4
-rw-r--r--unittests/gleantest_tests.py4
-rw-r--r--unittests/glsl_parser_test_tests.py4
-rw-r--r--unittests/grouptools_tests.py4
-rw-r--r--unittests/gtest_tests.py4
-rw-r--r--unittests/integration_tests.py4
-rw-r--r--unittests/json_backend_tests.py4
-rw-r--r--unittests/json_results_update_tests.py4
-rw-r--r--unittests/json_tests.py4
-rw-r--r--unittests/junit_backends_tests.py4
-rw-r--r--unittests/log_tests.py4
-rw-r--r--unittests/oglconform_tests.py4
-rw-r--r--unittests/opencv_tests.py4
-rw-r--r--unittests/opengl_tests.py4
-rw-r--r--unittests/options_tests.py4
-rw-r--r--unittests/piglit_test_tests.py4
-rw-r--r--unittests/profile_tests.py4
-rw-r--r--unittests/results_tests.py19
-rw-r--r--unittests/run_parser_tests.py4
-rw-r--r--unittests/shader_test_tests.py4
-rw-r--r--unittests/status_tests.py4
-rw-r--r--unittests/summary_common_tests.py4
-rw-r--r--unittests/summary_console_tests.py4
-rw-r--r--unittests/summary_html_tests.py4
-rw-r--r--unittests/test_lists.py4
-rw-r--r--unittests/utils.py4
32 files changed, 102 insertions, 41 deletions
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