diff mbox

[KVM-AUTOTEST,1/2] Add parse_results_file method to scan_results.py

Message ID 1246035651-29508-2-git-send-email-ryanh@us.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ryan Harper June 26, 2009, 5 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/client/tests/kvm/scan_results.py b/client/tests/kvm/scan_results.py
index 95507bd..175744a 100755
--- a/client/tests/kvm/scan_results.py
+++ b/client/tests/kvm/scan_results.py
@@ -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)