update code to be python3-compatible
This mostly fixes print statements and some pep8 issues. Change-Id: Ie4fb0ac8955759954d882988d698fb4aace61de1 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
5d83b029f4
commit
6d0b0aef62
@ -12,6 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import ast
|
||||
import argparse
|
||||
import importlib
|
||||
@ -152,41 +154,41 @@ def run():
|
||||
exit_code = 0
|
||||
if len(missing_uuids) > 0:
|
||||
exit_code = 1
|
||||
print "### Idempotent ID Errors Detected. To resolve these errors, " \
|
||||
"fix the uuid name (format id-<uuid>) in the guideline to " \
|
||||
"match the id in the test suite:"
|
||||
print("### Idempotent ID Errors Detected. To resolve these errors, "
|
||||
"fix the uuid name (format id-<uuid>) in the guideline to "
|
||||
"match the id in the test suite:")
|
||||
for test in missing_uuids:
|
||||
print "Idempotent ID in guideline '%s' does not appear in test " \
|
||||
"library '%s'\n" \
|
||||
" idempotent_id:\n" \
|
||||
" %s\n" \
|
||||
" names: " % (args.guideline_file, args.testlib, test[0])
|
||||
print("Idempotent ID in guideline '%s' does not appear in test "
|
||||
"library '%s'\n"
|
||||
" idempotent_id:\n"
|
||||
" %s\n"
|
||||
" names: " % (args.guideline_file, args.testlib, test[0]))
|
||||
for testname in test[1]:
|
||||
print " %s" % (testname)
|
||||
print ""
|
||||
print(" %s" % (testname))
|
||||
print("")
|
||||
|
||||
if len(missing_tests) > 0:
|
||||
exit_code = 1
|
||||
print "### Test Name Errors Detected. " \
|
||||
"To resolve these errors, update " \
|
||||
"the Interop guideline with the missing " \
|
||||
"test names:"
|
||||
print("### Test Name Errors Detected. "
|
||||
"To resolve these errors, update "
|
||||
"the Interop guideline with the missing "
|
||||
"test names:")
|
||||
for uuid in missing_tests:
|
||||
print "Test found in test library '%s'\n" \
|
||||
" idempotent_id:\n" \
|
||||
" %s\n" \
|
||||
" name:\n" \
|
||||
" %s\n" \
|
||||
"Entry in guideline '%s'\n" \
|
||||
" idempotent_id:\n" \
|
||||
" %s\n" \
|
||||
print("Test found in test library '%s'\n"
|
||||
" idempotent_id:\n"
|
||||
" %s\n"
|
||||
" name:\n"
|
||||
" %s\n"
|
||||
"Entry in guideline '%s'\n"
|
||||
" idempotent_id:\n"
|
||||
" %s\n"
|
||||
" names: " % (args.testlib,
|
||||
uuid, tests[uuid],
|
||||
args.guideline_file,
|
||||
missing_tests[uuid][0])
|
||||
missing_tests[uuid][0]))
|
||||
for testname in missing_tests[uuid][1]:
|
||||
print " %s" % (testname)
|
||||
print ""
|
||||
print(" %s" % (testname))
|
||||
print("")
|
||||
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
@ -57,7 +57,7 @@ if not isinstance(data, dict):
|
||||
outFileName = 'doc/source/guidelines/' + inFileName.replace("json", "rst")
|
||||
|
||||
|
||||
print ("Writing to: " + outFileName)
|
||||
print("Writing to: " + outFileName)
|
||||
|
||||
|
||||
# intro
|
||||
|
@ -14,6 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
import json
|
||||
import argparse
|
||||
@ -194,7 +196,7 @@ with open(args.score_file_name) as filehandle:
|
||||
|
||||
# And stdout is useful for folks who are experimenting with
|
||||
# the effect of changing a score.
|
||||
print "%s: %d%s" % (cap_name, total, meets_criteria)
|
||||
print("%s: %d%s" % (cap_name, total, meets_criteria))
|
||||
|
||||
# Now we can write the text output file.
|
||||
with open(args.text_outfile_name, 'w') as outfile:
|
||||
@ -202,5 +204,5 @@ with open(args.text_outfile_name, 'w') as outfile:
|
||||
outfile.write(line)
|
||||
outfile.close()
|
||||
|
||||
print "\n\nText output has been written to %s" % args.text_outfile_name
|
||||
print "CSV output has been written to %s" % args.csv_outfile_name
|
||||
print("\n\nText output has been written to %s" % args.text_outfile_name)
|
||||
print("CSV output has been written to %s" % args.csv_outfile_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user