Merge "Remove white space between print ()"

This commit is contained in:
Jenkins 2017-09-20 23:45:55 +00:00 committed by Gerrit Code Review
commit 83f282a483
3 changed files with 15 additions and 15 deletions

View File

@ -20,7 +20,7 @@ def main():
Main: Wrapper for shared_func tests Main: Wrapper for shared_func tests
""" """
# Usage: python suite_admin_run.py # Usage: python suite_admin_run.py
print ("Functional Test Script to execute Shared Resource Testcases") print("Functional Test Script to execute Shared Resource Testcases")
cmd_list = ["sudo sh -c 'cat /dev/null > test_results_admin.txt'", cmd_list = ["sudo sh -c 'cat /dev/null > test_results_admin.txt'",
"sudo chmod 777 test_results_admin.txt "] "sudo chmod 777 test_results_admin.txt "]
for cmd in cmd_list: for cmd in cmd_list:
@ -29,16 +29,16 @@ def main():
'tc_gbp_prs_pr_shared_func.py'] 'tc_gbp_prs_pr_shared_func.py']
for test in test_list: for test in test_list:
cmd = 'python %s' % (test) cmd = 'python %s' % (test)
print (cmd) print(cmd)
subprocess.call(cmd, shell=True) subprocess.call(cmd, shell=True)
results_file = open("test_results_admin.txt") results_file = open("test_results_admin.txt")
contents = results_file.read() contents = results_file.read()
results_file.close() results_file.close()
print (contents) print(contents)
print ("\n\nTotal Number of Shared Resource TestCases Executed= %s" % ( print("\n\nTotal Number of Shared Resource TestCases Executed= %s" % (
contents.count("_SHARED_"))) contents.count("_SHARED_")))
print ("\n\nNumber of TestCases Passed= %s" % (contents.count("PASSED"))) print("\n\nNumber of TestCases Passed= %s" % (contents.count("PASSED")))
print ("\n\nNumber of TestCases Failed= %s" % (contents.count("FAILED"))) print("\n\nNumber of TestCases Failed= %s" % (contents.count("FAILED")))
if contents.count("FAILED") > 0: if contents.count("FAILED") > 0:
sys.exit(1) sys.exit(1)
else: else:

View File

@ -43,29 +43,29 @@ def main():
try: try:
flag = sys.argv[1] flag = sys.argv[1]
except Exception: except Exception:
print ('%s' % (usage)) print('%s' % (usage))
sys.exit(1) sys.exit(1)
fname = run_func_neg() fname = run_func_neg()
num_lines = sum(1 for line in open(fname)) num_lines = sum(1 for line in open(fname))
print ("\nNumber of Functional Test Scripts to execute = %s" % (num_lines)) print("\nNumber of Functional Test Scripts to execute = %s" % (num_lines))
with open(fname) as f: with open(fname) as f:
for i, l in enumerate(f, 1): for i, l in enumerate(f, 1):
print ("Functional Test Script to execute now == %s" % l) print("Functional Test Script to execute now == %s" % l)
# Assumption: test-scripts are executable from any location # Assumption: test-scripts are executable from any location
# Reading the line from text file, also reads trailing \n, hence we # Reading the line from text file, also reads trailing \n, hence we
# need to strip # need to strip
cmd = 'python %s %s' % (l.strip(), flag) cmd = 'python %s %s' % (l.strip(), flag)
print (cmd) print(cmd)
# out=getoutput(cmd) # out=getoutput(cmd)
subprocess.call(cmd, shell=True) subprocess.call(cmd, shell=True)
f = open("test_results.txt") f = open("test_results.txt")
contents = f.read() contents = f.read()
f.close() f.close()
print (contents) print(contents)
print ("\n\nTotal Number of TestCases Executed= %s" % ( print("\n\nTotal Number of TestCases Executed= %s" % (
contents.count("TESTCASE_GBP_"))) contents.count("TESTCASE_GBP_")))
print ("\n\nNumber of TestCases Passed= %s" % (contents.count("PASSED"))) print("\n\nNumber of TestCases Passed= %s" % (contents.count("PASSED")))
print ("\n\nNumber of TestCases Failed= %s" % (contents.count("FAILED"))) print("\n\nNumber of TestCases Failed= %s" % (contents.count("FAILED")))
if contents.count("FAILED") > 0: if contents.count("FAILED") > 0:
sys.exit(1) sys.exit(1)
else: else:

View File

@ -54,7 +54,7 @@ def main():
f = open("test_results.txt") f = open("test_results.txt")
contents = f.read() contents = f.read()
f.close() f.close()
print (contents) print(contents)
print("\n\nTotal Number of TestCases Executed= %s" % ( print("\n\nTotal Number of TestCases Executed= %s" % (
contents.count("TESTCASE_GBP_"))) contents.count("TESTCASE_GBP_")))
print("\n\nNumber of TestCases Passed= %s" % (contents.count("PASSED"))) print("\n\nNumber of TestCases Passed= %s" % (contents.count("PASSED")))