Commit 491a658b authored by Vinson Lee's avatar Vinson Lee

Python: Add spaces after commas.

parent 4f9b764c
......@@ -103,10 +103,10 @@ class TestResult(dict):
'dict': dict.__repr__(self)
}
def allTestResults(self,name):
def allTestResults(self, name):
return {name: self}
def write(self,file,path):
def write(self, file, path):
print >>file, "@test: " + encode(path)
for k in self:
v = self[k]
......@@ -142,7 +142,7 @@ class GroupResult(dict):
def allTestResults(self, groupName):
collection = {}
for name,sub in self.items():
for name, sub in self.items():
subfullname = name
if len(groupName) > 0:
subfullname = groupName + '/' + subfullname
......@@ -150,7 +150,7 @@ class GroupResult(dict):
return collection
def write(self, file, groupName):
for name,sub in self.items():
for name, sub in self.items():
subfullname = name
if len(groupName) > 0:
subfullname = groupName + '/' + subfullname
......@@ -237,7 +237,7 @@ class TestrunResult:
stack[-1](line[0:-1])
linenr = linenr + 1
def parseDir(self,path,PreferSummary):
def parseDir(self, path, PreferSummary):
main = None
filelist = [path + '/main', path + '/summary']
if PreferSummary:
......@@ -264,10 +264,10 @@ class Environment:
self.execute = True
self.filter = []
def run(self,command):
def run(self, command):
p = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout,stderr) = p.communicate();
(stdout, stderr) = p.communicate();
return stderr+stdout
def collectData(self):
......@@ -316,7 +316,7 @@ class Test:
print " result: %(result)s" % { 'result': result['result'] }
result.write(env.file,path)
result.write(env.file, path)
if Test.sleep:
time.sleep(Test.sleep)
else:
......@@ -382,12 +382,12 @@ def loadTestProfile(filename):
traceback.print_exc()
raise Exception('Could not read tests profile')
def loadTestResults(path,PreferSummary=False):
def loadTestResults(path, PreferSummary=False):
try:
mode = os.stat(path)[stat.ST_MODE]
testrun = TestrunResult()
if stat.S_ISDIR(mode):
testrun.parseDir(path,PreferSummary)
testrun.parseDir(path, PreferSummary)
else:
file = open(path, 'r')
testrun.parseFile(file)
......
......@@ -44,7 +44,7 @@ class PlainExecTest(Test):
stderr=subprocess.PIPE,
universal_newlines=True
)
out,err = proc.communicate()
out, err = proc.communicate()
outlines = out.split('\n')
outpiglit = map(lambda s: s[7:], filter(lambda s: s.startswith('PIGLIT:'), outlines))
......
......@@ -28,13 +28,13 @@ import core
##### Vector indicating the number of subtests that have passed/failed/etc.
#############################################################################
class PassVector:
def __init__(self,p,w,f,s):
def __init__(self, p, w, f, s):
self.passnr = p
self.warnnr = w
self.failnr = f
self.skipnr = s
def add(self,o):
def add(self, o):
self.passnr += o.passnr
self.warnnr += o.warnnr
self.failnr += o.failnr
......@@ -106,7 +106,7 @@ results is an array of GroupResult instances, one per testrun
# Perform some initial annotations
for j in range(len(self.results)):
result = self.results[j]
result.passvector = PassVector(0,0,0,0)
result.passvector = PassVector(0, 0, 0, 0)
result.testrun = self.summary.testruns[j]
# Collect, create and annotate children
......
......@@ -55,7 +55,7 @@ def main():
OptionName = ''
for name,value in options:
for name, value in options:
if name in ('-h', '--help'):
usage()
......@@ -65,7 +65,7 @@ def main():
resultsFilename = args[0]
results = core.loadTestResults(resultsFilename)
for testname,result in results.allTestResults().items():
for testname, result in results.allTestResults().items():
if 'info' in result:
if len(result['info']) > 4096:
result['info'] = result['info'][0:4096]
......
......@@ -68,7 +68,7 @@ def main():
OptionName = ''
for name,value in options:
for name, value in options:
if name in ('-h', '--help'):
usage()
elif name in ('-d', '--dry-run'):
......@@ -95,7 +95,7 @@ def main():
print "Writing summary file..."
results = core.loadTestResults(resultsDir)
for testname,result in results.allTestResults().items():
for testname, result in results.allTestResults().items():
if 'info' in result:
if len(result['info']) > 4096:
result['info'] = result['info'][0:4096]
......
......@@ -99,13 +99,13 @@ def buildDetails(testResult):
continue
value = buildDetailValue(testResult[name])
details += [(name,value)]
details += [(name, value)]
details.sort(lambda a,b: len(a[1])-len(b[1]))
details.sort(lambda a, b: len(a[1])-len(b[1]))
text = ''
alternate = 'a'
for name,value in details:
for name, value in details:
text += ResultDetail % locals()
if alternate == 'a':
......@@ -265,7 +265,7 @@ def parse_listfile(filename):
file.close()
return eval(code)
def loadresult(descr,OptionPreferSummary):
def loadresult(descr, OptionPreferSummary):
result = core.loadTestResults(descr[0], OptionPreferSummary)
if len(descr) > 1:
result.__dict__.update(descr[1])
......@@ -280,7 +280,7 @@ def main():
OptionOverwrite = False
OptionPreferSummary = True
OptionList = []
for name,value in options:
for name, value in options:
if name == "-h" or name == "--help":
usage()
elif name == "-o" or name == "--overwrite":
......@@ -298,7 +298,7 @@ def main():
summaryDir = args[0]
core.checkDir(summaryDir, not OptionOverwrite)
results = [loadresult(descr,OptionPreferSummary) for descr in OptionList]
results = [loadresult(descr, OptionPreferSummary) for descr in OptionList]
summary = framework.summary.Summary(results)
for j in range(len(summary.testruns)):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment