[Piglit] [PATCH] tests/igt.tests: PEP8 compliance

Dylan Baker baker.dylan.c at gmail.com
Mon Nov 4 09:00:38 PST 2013


formatting changes.

- replace tabs with 8 spaces
- fix long lines
- remove trailing semicolons
- fix hanging indent problems
- add two spaces before and after top level classes and functions
- use os.path.join instead of concat

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 tests/igt.tests | 73 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/tests/igt.tests b/tests/igt.tests
index ec17de5..8160e56 100644
--- a/tests/igt.tests
+++ b/tests/igt.tests
@@ -48,71 +48,72 @@ igtTestRoot = path.join(path.realpath(path.join(testBinDir, 'igt')), 'tests')
 
 profile = TestProfile()
 
+
 class IGTTest(ExecTest):
     def __init__(self, binary, arguments=[]):
-	ExecTest.__init__(self, [path.join(igtTestRoot, binary)] + arguments)
+        ExecTest.__init__(self, [path.join(igtTestRoot, binary)] + arguments)
 
     def interpretResult(self, out, returncode, results, dmesg):
-	if returncode == 0:
-	    results['result'] = 'dmesg-warn' if dmesg != '' else 'pass'
-	elif returncode == 77:
-	    results['result'] = 'skip'
-	else:
-	    results['result'] = 'dmesg-fail' if dmesg != '' else 'fail'
-	return out
+        if returncode == 0:
+            results['result'] = 'dmesg-warn' if dmesg != '' else 'pass'
+        elif returncode == 77:
+            results['result'] = 'skip'
+        else:
+            results['result'] = 'dmesg-fail' if dmesg != '' else 'fail'
+        return out
+
 
 def listTests(listname):
     oldDir = os.getcwd()
     try:
-	os.chdir(igtTestRoot)
-	proc = subprocess.Popen(
-		['make', listname ],
-		stdout=subprocess.PIPE,
-		stderr=subprocess.PIPE,
-		env=os.environ.copy(),
-		universal_newlines=True
-		)
-	out, err = proc.communicate()
-	returncode = proc.returncode
+        os.chdir(igtTestRoot)
+        proc = subprocess.Popen(['make', listname],
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE,
+                                env=os.environ.copy(),
+                                universal_newlines=True)
+        out, err = proc.communicate()
+        returncode = proc.returncode
     finally:
-	os.chdir(oldDir)
+        os.chdir(oldDir)
 
     lines = out.split('\n')
     found_header = False
     progs = ""
 
     for line in lines:
-	if found_header:
-	    progs = line.split(" ")
-	    break
-
-	if "TESTLIST" in line:
-	    found_header = True;
+        if found_header:
+            progs = line.split(" ")
+            break
+        elif "TESTLIST" in line:
+            found_header = True
 
     return progs
 
+
 singleTests = listTests("list-single-tests")
 
 for test in singleTests:
-    profile.test_list['igt/' + test] = IGTTest(test)
+    profile.test_list[path.join('igt', test)] = IGTTest(test)
+
 
 def addSubTestCases(test):
-    proc = subprocess.Popen(
-	    [path.join(igtTestRoot, test), '--list-subtests' ],
-	    stdout=subprocess.PIPE,
-	    stderr=subprocess.PIPE,
-	    env=os.environ.copy(),
-	    universal_newlines=True
-	    )
+    proc = subprocess.Popen([path.join(igtTestRoot, test), '--list-subtests'],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE,
+                            env=os.environ.copy(),
+                            universal_newlines=True)
     out, err = proc.communicate()
     returncode = proc.returncode
 
     subtests = out.split("\n")
 
     for subtest in subtests:
-	if subtest == "":
-	    continue
-	profile.test_list['igt/' + test + '/' + subtest] = IGTTest(test, ['--run-subtest', subtest])
+        if subtest == "":
+            continue
+        profile.test_list[path.join('igt', test, subtest)] = \
+            IGTTest(test, ['--run-subtest', subtest])
+
 
 multiTests = listTests("list-multi-tests")
 
-- 
1.8.1.5



More information about the Piglit mailing list