summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-01-04 16:42:45 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2016-02-08 12:29:33 -0800
commitf41158915be47daae8bcf4c7afd54bec577f9454 (patch)
tree18b6aa319c6fbbdd3ffcdbb68196054be70720e8
parent8c3bb871120f81b7c57b214ee2771184060a4d6b (diff)
python: use future print, division, and absolute_import
These are the three python3 like behaviors that piglit should rely on. The only other applicable future import is unicode_literals. Although my plan is to use unicode_literals, that will actually cause behavioral changes in some cases, where these cause minimal changes to the code. Piglit will not be targeting < 3.2, they are old, unsupported, and have fewer features than 2.7. Piglit now has division (using / as floating division, and // as integer division), print as a function (rather than a statement), and absolute import, which changes the way import works when there's a conflict between a local import and a system wide one. Absolute import makes more sense, and copies the behavior of python 3 Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
-rw-r--r--framework/backends/__init__.py1
-rw-r--r--framework/backends/abstract.py2
-rw-r--r--framework/backends/json.py2
-rw-r--r--framework/backends/junit.py2
-rw-r--r--framework/backends/register.py1
-rw-r--r--framework/core.py2
-rw-r--r--framework/grouptools.py2
-rw-r--r--framework/log.py2
-rw-r--r--framework/profile.py2
-rw-r--r--framework/programs/run.py3
-rw-r--r--framework/programs/summary.py2
-rw-r--r--framework/results.py2
-rw-r--r--framework/status.py2
-rw-r--r--framework/test/__init__.py2
-rw-r--r--framework/test/base.py2
-rw-r--r--framework/test/deqp.py1
-rw-r--r--framework/test/gleantest.py2
-rw-r--r--framework/test/glsl_parser_test.py2
-rw-r--r--framework/test/gtest.py2
-rw-r--r--framework/test/oclconform.py2
-rw-r--r--framework/test/opencv.py2
-rw-r--r--framework/test/piglit_test.py2
-rw-r--r--framework/test/shader_test.py2
-rw-r--r--registry/gl.py3
-rw-r--r--tests/util/gen_dispatch.py2
-rw-r--r--unittests/backends_tests.py2
-rw-r--r--unittests/base_tests.py2
-rw-r--r--unittests/core_tests.py2
-rw-r--r--unittests/gleantest_tests.py2
-rw-r--r--unittests/glsl_parser_test_tests.py2
-rw-r--r--unittests/grouptools_tests.py2
-rw-r--r--unittests/gtest_tests.py2
-rw-r--r--unittests/integration_tests.py2
-rw-r--r--unittests/json_backend_tests.py2
-rw-r--r--unittests/json_tests.py2
-rw-r--r--unittests/junit_backends_tests.py2
-rw-r--r--unittests/log_tests.py2
-rw-r--r--unittests/oglconform_tests.py1
-rw-r--r--unittests/opencv_tests.py2
-rw-r--r--unittests/piglit_test_tests.py2
-rw-r--r--unittests/profile_tests.py2
-rw-r--r--unittests/results_tests.py3
-rw-r--r--unittests/run_parser_tests.py2
-rw-r--r--unittests/shader_test_tests.py2
-rw-r--r--unittests/status_tests.py2
-rw-r--r--unittests/summary_common_tests.py2
-rw-r--r--unittests/test_lists.py2
-rw-r--r--unittests/utils.py2
48 files changed, 49 insertions, 46 deletions
diff --git a/framework/backends/__init__.py b/framework/backends/__init__.py
index b0f784fd8..1b814a2d3 100644
--- a/framework/backends/__init__.py
+++ b/framework/backends/__init__.py
@@ -41,6 +41,7 @@ that a user actually wants.
"""
+from __future__ import absolute_import, division, print_function
import os
import importlib
diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index b8540ddc6..56aed3f87 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -25,7 +25,7 @@ This module provides mixins and base classes for backend modules.
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import abc
import contextlib
import itertools
diff --git a/framework/backends/json.py b/framework/backends/json.py
index 99f7e87a4..8e4dc13a3 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -20,7 +20,7 @@
""" Module providing json backend for piglit """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import sys
import shutil
diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index 16e5cc138..e6c5d3a72 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -20,7 +20,7 @@
""" Module implementing a JUnitBackend for piglit """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os.path
import shutil
diff --git a/framework/backends/register.py b/framework/backends/register.py
index a52083b46..fc3e79b55 100644
--- a/framework/backends/register.py
+++ b/framework/backends/register.py
@@ -20,6 +20,7 @@
"""An object for registering backends."""
+from __future__ import absolute_import, division, print_function
import collections
Registry = collections.namedtuple(
diff --git a/framework/core.py b/framework/core.py
index 13298a6e4..bcf4ea5e1 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -22,7 +22,7 @@
# Piglit core
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import errno
import os
import subprocess
diff --git a/framework/grouptools.py b/framework/grouptools.py
index e4157efeb..a7f26bde9 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -29,6 +29,8 @@ posix paths they may not start with a leading '/'.
"""
+from __future__ import absolute_import, division, print_function
+
__all__ = [
'SEPARATOR',
'commonprefix',
diff --git a/framework/log.py b/framework/log.py
index 20a989730..5bd69027f 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -26,7 +26,7 @@ returning BaseLog derived instances to individual tests.
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import sys
import abc
import itertools
diff --git a/framework/profile.py b/framework/profile.py
index 32ed759e3..94343dbc3 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -26,7 +26,7 @@ are represented by a TestProfile or a TestProfile derived object.
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import multiprocessing
import multiprocessing.dummy
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 328e0b087..c4d477052 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -19,8 +19,7 @@
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
-
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
import argparse
import sys
import os
diff --git a/framework/programs/summary.py b/framework/programs/summary.py
index b23f1ef31..6cf6121d2 100644
--- a/framework/programs/summary.py
+++ b/framework/programs/summary.py
@@ -19,7 +19,7 @@
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import argparse
import shutil
import os
diff --git a/framework/results.py b/framework/results.py
index bdcc993c5..ffc528792 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -21,7 +21,7 @@
""" Module for results generation """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import collections
import copy
diff --git a/framework/status.py b/framework/status.py
index 458cd84ac..d188f169c 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -56,7 +56,7 @@ The formula for determining fixes is:
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
from framework import exceptions
__all__ = ['NOTRUN',
diff --git a/framework/test/__init__.py b/framework/test/__init__.py
index a9b5f4e39..1d1836420 100644
--- a/framework/test/__init__.py
+++ b/framework/test/__init__.py
@@ -24,7 +24,7 @@
# create a general use API, but allow it to be controlled by setting the
# __all__ in each module
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
from .base import *
from .piglit_test import *
from .gleantest import *
diff --git a/framework/test/base.py b/framework/test/base.py
index 37beb93b5..faad0434d 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -22,7 +22,7 @@
""" Module provides a base class for Tests """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import errno
import os
import time
diff --git a/framework/test/deqp.py b/framework/test/deqp.py
index 5c84131c9..ae6c59173 100644
--- a/framework/test/deqp.py
+++ b/framework/test/deqp.py
@@ -18,6 +18,7 @@
# 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
import abc
import os
import subprocess
diff --git a/framework/test/gleantest.py b/framework/test/gleantest.py
index acc398342..a12b2aded 100644
--- a/framework/test/gleantest.py
+++ b/framework/test/gleantest.py
@@ -22,7 +22,7 @@
""" Glean support """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
from framework import options
diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py
index e17fd64bc..da223fbf3 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -21,7 +21,7 @@
""" This module enables the running of GLSL parser tests. """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import re
diff --git a/framework/test/gtest.py b/framework/test/gtest.py
index 6eba4cb44..547f92a2f 100644
--- a/framework/test/gtest.py
+++ b/framework/test/gtest.py
@@ -22,7 +22,7 @@
# Authors: Tom Stellard <thomas.stellard@amd.com>
#
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import re
from .base import Test
diff --git a/framework/test/oclconform.py b/framework/test/oclconform.py
index eb3adb435..8a652f7c4 100644
--- a/framework/test/oclconform.py
+++ b/framework/test/oclconform.py
@@ -22,7 +22,7 @@
# Authors: Tom Stellard <thomas.stellard@amd.com>
#
-from __future__ import print_function, print_function
+from __future__ import absolute_import, division, print_function
import re
import subprocess
from os.path import join
diff --git a/framework/test/opencv.py b/framework/test/opencv.py
index 157102e51..bb8621ba1 100644
--- a/framework/test/opencv.py
+++ b/framework/test/opencv.py
@@ -22,7 +22,7 @@
# Authors: Tom Stellard <thomas.stellard@amd.com>
#
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import re
import subprocess
from os import path
diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index d17363219..998a4eed0 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -22,7 +22,7 @@
""" Module provides a base class for Tests """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import sys
import glob
diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index dcfc16a3f..c96b4a7fa 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -23,7 +23,7 @@
""" This module enables running shader tests. """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import re
from framework import exceptions
diff --git a/registry/gl.py b/registry/gl.py
index e87bf5ca5..98b1ee333 100644
--- a/registry/gl.py
+++ b/registry/gl.py
@@ -23,8 +23,7 @@
Parse gl.xml into Python objects.
"""
-from __future__ import print_function
-
+from __future__ import absolute_import, division, print_function
import os.path
import re
diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
index dd056871b..a4dbf24de 100644
--- a/tests/util/gen_dispatch.py
+++ b/tests/util/gen_dispatch.py
@@ -24,7 +24,7 @@
Generate C source code from Khronos XML.
"""
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
import argparse
import os.path
diff --git a/unittests/backends_tests.py b/unittests/backends_tests.py
index 29e9a18b4..54d5e6295 100644
--- a/unittests/backends_tests.py
+++ b/unittests/backends_tests.py
@@ -22,7 +22,7 @@
""" Tests for the backend package """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import nose.tools as nt
diff --git a/unittests/base_tests.py b/unittests/base_tests.py
index 68a9c93cc..37504d947 100644
--- a/unittests/base_tests.py
+++ b/unittests/base_tests.py
@@ -20,7 +20,7 @@
""" Tests for the exectest module """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import tempfile
import textwrap
import os
diff --git a/unittests/core_tests.py b/unittests/core_tests.py
index 2699a148b..bc80a47fb 100644
--- a/unittests/core_tests.py
+++ b/unittests/core_tests.py
@@ -20,7 +20,7 @@
""" Module providing tests for the core module """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import collections
import shutil
diff --git a/unittests/gleantest_tests.py b/unittests/gleantest_tests.py
index fa732d5e5..ca06e3bac 100644
--- a/unittests/gleantest_tests.py
+++ b/unittests/gleantest_tests.py
@@ -20,7 +20,7 @@
""" Tests for the glean class. Requires Nose """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import mock
import nose.tools as nt
diff --git a/unittests/glsl_parser_test_tests.py b/unittests/glsl_parser_test_tests.py
index 831cde123..629b1d438 100644
--- a/unittests/glsl_parser_test_tests.py
+++ b/unittests/glsl_parser_test_tests.py
@@ -20,7 +20,7 @@
""" Provides tests for the shader_test module """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import textwrap
diff --git a/unittests/grouptools_tests.py b/unittests/grouptools_tests.py
index 3c92d8ef7..30d040428 100644
--- a/unittests/grouptools_tests.py
+++ b/unittests/grouptools_tests.py
@@ -20,7 +20,7 @@
"""Module with tests for grouptools."""
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
import nose.tools as nt
diff --git a/unittests/gtest_tests.py b/unittests/gtest_tests.py
index 8dd654550..43977aa9f 100644
--- a/unittests/gtest_tests.py
+++ b/unittests/gtest_tests.py
@@ -20,7 +20,7 @@
""" Module providing tests for gtest """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import nose.tools as nt
diff --git a/unittests/integration_tests.py b/unittests/integration_tests.py
index dc584b353..596fc54b2 100644
--- a/unittests/integration_tests.py
+++ b/unittests/integration_tests.py
@@ -26,7 +26,7 @@ errors and to ensure that the API hasn't changed without fixing these modules
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import importlib
from nose.plugins.skip import SkipTest
diff --git a/unittests/json_backend_tests.py b/unittests/json_backend_tests.py
index 066122aee..30a45f771 100644
--- a/unittests/json_backend_tests.py
+++ b/unittests/json_backend_tests.py
@@ -22,7 +22,7 @@
""" Tests for the backend package """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
try:
diff --git a/unittests/json_tests.py b/unittests/json_tests.py
index 417b46a1a..e1cd4182f 100644
--- a/unittests/json_tests.py
+++ b/unittests/json_tests.py
@@ -26,7 +26,7 @@ tests and they will change with each version of the json output.
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import nose.tools as nt
diff --git a/unittests/junit_backends_tests.py b/unittests/junit_backends_tests.py
index 1e71f3ffd..fda76b2a1 100644
--- a/unittests/junit_backends_tests.py
+++ b/unittests/junit_backends_tests.py
@@ -22,7 +22,7 @@
""" Tests for the backend package """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
try:
diff --git a/unittests/log_tests.py b/unittests/log_tests.py
index 1f1cf33e4..5c7a8ba90 100644
--- a/unittests/log_tests.py
+++ b/unittests/log_tests.py
@@ -20,7 +20,7 @@
""" Module provides tests for log.py module """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import sys
import collections
import threading
diff --git a/unittests/oglconform_tests.py b/unittests/oglconform_tests.py
index 35a4bdfe7..5ccb99979 100644
--- a/unittests/oglconform_tests.py
+++ b/unittests/oglconform_tests.py
@@ -20,6 +20,7 @@
"""Tests for the oglconform integration."""
+from __future__ import absolute_import, division, print_function
from StringIO import StringIO
import mock
diff --git a/unittests/opencv_tests.py b/unittests/opencv_tests.py
index 648f97850..94167ff68 100644
--- a/unittests/opencv_tests.py
+++ b/unittests/opencv_tests.py
@@ -20,7 +20,7 @@
""" Module for testing opencv """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
from . import utils
from framework.test import OpenCVTest
diff --git a/unittests/piglit_test_tests.py b/unittests/piglit_test_tests.py
index 1866296ba..f299af5e6 100644
--- a/unittests/piglit_test_tests.py
+++ b/unittests/piglit_test_tests.py
@@ -20,7 +20,7 @@
"""Tests for the piglit_test module"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import mock
import nose.tools as nt
diff --git a/unittests/profile_tests.py b/unittests/profile_tests.py
index 3d78afbc6..ca1aca47b 100644
--- a/unittests/profile_tests.py
+++ b/unittests/profile_tests.py
@@ -20,7 +20,7 @@
""" Provides test for the framework.profile modules """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import sys
import copy
diff --git a/unittests/results_tests.py b/unittests/results_tests.py
index 6a610f089..d40614e62 100644
--- a/unittests/results_tests.py
+++ b/unittests/results_tests.py
@@ -20,8 +20,7 @@
""" Module providing tests for the core module """
-
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import nose.tools as nt
diff --git a/unittests/run_parser_tests.py b/unittests/run_parser_tests.py
index 3dd87cc82..bce818906 100644
--- a/unittests/run_parser_tests.py
+++ b/unittests/run_parser_tests.py
@@ -20,7 +20,7 @@
""" Module of tests for the run commandline parser """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import sys
import os
import shutil
diff --git a/unittests/shader_test_tests.py b/unittests/shader_test_tests.py
index 1c9cec8b0..5feda63b5 100644
--- a/unittests/shader_test_tests.py
+++ b/unittests/shader_test_tests.py
@@ -20,7 +20,7 @@
""" Provides tests for the shader_test module """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import mock
diff --git a/unittests/status_tests.py b/unittests/status_tests.py
index c3c3b8ac1..f1ba96d81 100644
--- a/unittests/status_tests.py
+++ b/unittests/status_tests.py
@@ -25,7 +25,7 @@ etc
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import itertools
import nose.tools as nt
diff --git a/unittests/summary_common_tests.py b/unittests/summary_common_tests.py
index 81dd92103..93fecaf03 100644
--- a/unittests/summary_common_tests.py
+++ b/unittests/summary_common_tests.py
@@ -21,7 +21,7 @@
""" Module providing tests for the summary module """
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import datetime
import nose.tools as nt
diff --git a/unittests/test_lists.py b/unittests/test_lists.py
index e56714b63..f56f97962 100644
--- a/unittests/test_lists.py
+++ b/unittests/test_lists.py
@@ -26,7 +26,7 @@ es3conform, etc)
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import importlib
import os.path as path
diff --git a/unittests/utils.py b/unittests/utils.py
index aaf782c1f..190056db7 100644
--- a/unittests/utils.py
+++ b/unittests/utils.py
@@ -25,7 +25,7 @@ in a single place.
"""
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import, division, print_function
import os
import sys
import copy