[Piglit] [Patch v2 7/8] igt.py: Use __future__ functions, mainly print_function

Dylan Baker baker.dylan.c at gmail.com
Mon Jan 26 11:28:14 PST 2015


This makes igt more like the rest of piglit which uses the __future__
version of print, division, and import

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/igt.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/igt.py b/tests/igt.py
index 4a46fb0..ca8f295 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -30,6 +30,7 @@ automatically add all tests into the 'igt' category.
 
 """
 
+from __future__ import print_function, division, absolute_import
 import os
 import re
 import sys
@@ -51,10 +52,10 @@ def check_environment():
     """
     debugfs_path = "/sys/kernel/debug/dri"
     if os.getuid() != 0:
-        print "Test Environment check: not root!"
+        print("Test Environment check: not root!")
         return False
     if not os.path.isdir(debugfs_path):
-        print "Test Environment check: debugfs not mounted properly!"
+        print("Test Environment check: debugfs not mounted properly!")
         return False
     for subdir in os.listdir(debugfs_path):
         if not os.path.isdir(os.path.join(debugfs_path, subdir)):
@@ -62,10 +63,10 @@ def check_environment():
         clients = open(os.path.join(debugfs_path, subdir, "clients"), 'r')
         lines = clients.readlines()
         if len(lines) > 2:
-            print "Test Environment check: other drm clients running!"
+            print("Test Environment check: other drm clients running!")
             return False
 
-    print "Test Environment check: Succeeded."
+    print("Test Environment check: Succeeded.")
     return True
 
 
@@ -79,7 +80,7 @@ else:
 # check for the test lists
 if not (os.path.exists(os.path.join(IGT_TEST_ROOT, 'single-tests.txt'))
         and os.path.exists(os.path.join(IGT_TEST_ROOT, 'multi-tests.txt'))):
-    print "intel-gpu-tools test lists not found."
+    print("intel-gpu-tools test lists not found.")
     sys.exit(0)
 
 IGT_ENVIRONMENT_OK = check_environment()
@@ -151,7 +152,7 @@ def add_subtest_cases(test):
         return
 
     if proc.returncode != 0:
-        print "Error: Could not list subtests for " + test
+        print("Error: Could not list subtests for " + test)
         return
 
     subtests = out.split("\n")
-- 
2.2.2



More information about the Piglit mailing list