Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto_test.py: code refacturing #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions scripts/auto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import os,sys,commands

def auto_test(txt_file,ttf_file):
inputfile=open(txt_file)
outputfile=open("failed_test_case.txt","w")
with open(txt_file) as inputfile:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have exception for with

flines = inputfile.readlines()
with open("failed_test_case.txt", "w") as fobj:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have exception for with

outputfile = fobj

#Read the test-case input
flines=inputfile.readlines()
count=0
count=0

#Exceute hb-shape command for each test-case from output file
for string in flines:
Expand All @@ -39,8 +39,6 @@ def auto_test(txt_file,ttf_file):
#Count for failed test-cases
print "%d Test Cases Failed out of %d"%(count,len(flines))
print "failed_test_case.txt file generated !!"
inputfile.close()
outputfile.close()

if __name__ == "__main__":

Expand Down