@@ -42,6 +42,13 @@ def parse_results(text):
return result_list
+def parse_results_file(resfile):
+ f = file(resfile)
+ text = f.read()
+ f.close()
+ return parse_results(text)
+
+
def print_result(result):
"""Nicely print a single Autotest result.
@@ -55,11 +62,7 @@ def main(resfile):
print_result(('test', 'status', 'seconds', 'info'))
print_result(('----', '------', '-------', '----'))
- f = file(resfile)
- text = f.read()
- f.close()
-
- results = parse_results(text)
+ results = parse_results_file(resfile)
map(print_result, results)
o Add a new method, parse_results_file which takes a file, reads the data and invokes the parse_results method. o Refactor main() method to use parse_results_file. Signed-off-by: Ryan Harper <ryanh@us.ibm.com> --- client/tests/kvm/scan_results.py | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)