Skip to content

Commit

Permalink
Fix mixed indentations
Browse files Browse the repository at this point in the history
The code uses both spaces and tab in the same file.
According to PEP-8, use spaces only.

Change-Id: I5ac3512395ad6bd30c820ca1d549ad2acab2dc8f
Signed-off-by: Baohua Yang <baohyang@cn.ibm.com>
  • Loading branch information
yeasy committed Dec 18, 2016
1 parent f9e8f3b commit 77a2e8f
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions bddtests/steps/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@


def testCoverage():
#First save the coverage files
saveCoverageFiles("coverage","scenario_1", ["bddtests_vp0_1","bddtests_vp1_1","bddtests_vp2_1","bddtests_vp3_1",], "cov")
#First save the coverage files
saveCoverageFiles("coverage","scenario_1", ["bddtests_vp0_1","bddtests_vp1_1","bddtests_vp2_1","bddtests_vp3_1",], "cov")

# Now collect the filenames for coverage files.
files = glob.glob(os.path.join('coverage','*.cov'))
files = glob.glob(os.path.join('coverage','*.cov'))

#Create the aggregate coverage file
coverageContents = createCoverageFile(files)
coverageContents = createCoverageFile(files)

#Ouput the aggregate coverage file
with open('coverage.total', 'w') as outfile:
outfile.write(coverageContents)
outfile.close()
with open('coverage.total', 'w') as outfile:
outfile.write(coverageContents)
outfile.close()

def createCoverageAggregate():
# Now collect the filenames for coverage files.
Expand All @@ -39,10 +39,10 @@ def saveCoverageFiles(folderName, rootName, containerNames, extension):
'Will save the converage files to folderName'
# Make the directory
try:
os.makedirs(folderName)
os.makedirs(folderName)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
if exception.errno != errno.EEXIST:
raise
for containerName in containerNames:
srcPath = "{0}:/opt/gopath/src/github.com/hyperledger/fabric/coverage.cov".format(containerName)
print("sourcepath = {0}".format(srcPath))
Expand All @@ -68,27 +68,27 @@ def createCoverageFile(filenames):
#with open('coverage.total', 'w') as outfile:
for fname in filenames:
with open(fname) as infile:
firstLine = True
for line in infile:
if firstLine:
firstLine = False
continue
else:
# Split the line based upon white space
lineParts = line.split()
if lineParts[0] in linesMap:
# Found, keep the greater
newCount = long(lineParts[2])
oldCount = long(linesMap[lineParts[0]].split()[2])
if newCount > oldCount:
linesMap[lineParts[0]] = line
else:
linesMap[lineParts[0]] = line
firstLine = True
for line in infile:
if firstLine:
firstLine = False
continue
else:
# Split the line based upon white space
lineParts = line.split()
if lineParts[0] in linesMap:
# Found, keep the greater
newCount = long(lineParts[2])
oldCount = long(linesMap[lineParts[0]].split()[2])
if newCount > oldCount:
linesMap[lineParts[0]] = line
else:
linesMap[lineParts[0]] = line
# Now sort the output
od = OrderedDict(sorted(linesMap.items(), key=lambda i: i[1]))

for (key, line) in od.items():
output.write(line)
output.write(line)
contents = output.getvalue()
output.close()
return contents

0 comments on commit 77a2e8f

Please sign in to comment.