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

Dylan Baker baker.dylan.c at gmail.com
Wed Jan 28 11:35:07 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 3a6f5a2..53525eb 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -32,6 +32,7 @@ drm. Even if you have rendernode support enabled.
 
 """
 
+from __future__ import print_function, division, absolute_import
 import os
 import re
 import sys
@@ -52,10 +53,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)):
@@ -63,10 +64,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
 
 
@@ -80,7 +81,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)
 
 
@@ -147,7 +148,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