extracttests.py: python 3 compatibility updates

This commit is contained in:
Daniel Marjamäki 2011-12-07 17:05:24 +01:00
parent 612b3c59ca
commit ab348387b5
1 changed files with 8 additions and 8 deletions

View File

@ -135,8 +135,8 @@ def writeHtmlFile(nodes, functionName, filename, errorsOnly):
if len(sys.argv) <= 1 or '--help' in sys.argv: if len(sys.argv) <= 1 or '--help' in sys.argv:
print 'Extract test cases from test file' print('Extract test cases from test file')
print 'Syntax: extracttests.py [--html=folder] [--xml] [--code=folder] path/testfile.cpp' print('Syntax: extracttests.py [--html=folder] [--xml] [--code=folder] path/testfile.cpp')
sys.exit(0) sys.exit(0)
# parse command line # parse command line
@ -154,7 +154,7 @@ for arg in sys.argv[1:]:
elif arg.endswith('.cpp'): elif arg.endswith('.cpp'):
filename = arg filename = arg
else: else:
print 'Invalid option: ' + arg print('Invalid option: ' + arg)
sys.exit(1) sys.exit(1)
@ -166,8 +166,8 @@ if filename != None:
# generate output # generate output
if xml: if xml:
print '<?xml version="1.0"?>' print('<?xml version="1.0"?>')
print '<tree>' print('<tree>')
count = 0 count = 0
for node in e.nodes: for node in e.nodes:
s = ' <node' s = ' <node'
@ -175,8 +175,8 @@ if filename != None:
s += ' code="' + strtoxml(node['code']) + '"' s += ' code="' + strtoxml(node['code']) + '"'
s += ' expected="' + strtoxml(node['expected']) + '"' s += ' expected="' + strtoxml(node['expected']) + '"'
s += '/>' s += '/>'
print s print(s)
print '</tree>' print('</tree>')
elif htmldir != None: elif htmldir != None:
if not htmldir.endswith('/'): if not htmldir.endswith('/'):
htmldir += '/' htmldir += '/'
@ -277,5 +277,5 @@ if filename != None:
errors.close() errors.close()
else: else:
for node in e.nodes: for node in e.nodes:
print node['functionName'] print(node['functionName'])