This is an automated email from the ASF dual-hosted git repository.

bipinprasad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new ef965be97 [STORM-3851] Fix syntax errors and modify to run under 
python3 (#3470)
ef965be97 is described below

commit ef965be9770912357232cb0f512cc632891ab0c8
Author: Bipin Prasad <[email protected]>
AuthorDate: Wed Apr 6 18:18:23 2022 -0700

    [STORM-3851] Fix syntax errors and modify to run under python3 (#3470)
---
 dev-tools/travis/print-errors-from-test-reports.py | 45 +++++++++++-----------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/dev-tools/travis/print-errors-from-test-reports.py 
b/dev-tools/travis/print-errors-from-test-reports.py
index 72af6d5e1..886b9ab55 100644
--- a/dev-tools/travis/print-errors-from-test-reports.py
+++ b/dev-tools/travis/print-errors-from-test-reports.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 # -*- coding: utf-8 -*-
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -18,19 +18,20 @@ import glob
 import traceback
 from xml.etree.ElementTree import ElementTree
 
+
 def print_detail_information(testcase, fail_or_error):
-    print "-" * 50
-    print "classname: %s / testname: %s" % (testcase.get("classname"), 
testcase.get("name"))
-    print fail_or_error.text
+    print("-" * 50)
+    print("classname: %s / testname: %s" % (testcase.get("classname"), 
testcase.get("name")))
+    print(fail_or_error.text)
     stdout = testcase.find("system-out")
-    if stdout != None:
-        print "-" * 20, "system-out", "-"*20
-        print stdout.text
+    if stdout is not None:
+        print("-" * 20, "system-out", "-"*20)
+        print(stdout.text)
     stderr = testcase.find("system-err")
-    if stderr != None:
-        print "-" * 20, "system-err", "-"*20
-        print stderr.text
-    print "-" * 50
+    if stderr is not None:
+        print("-" * 20, "system-err", "-"*20)
+        print(stderr.text)
+    print("-" * 50)
 
 
 def print_error_reports_from_report_file(file_path):
@@ -38,11 +39,11 @@ def print_error_reports_from_report_file(file_path):
     try:
         tree.parse(file_path)
     except:
-        print "-" * 50
-        print "Error parsing %s"%file_path
-        f = open(file_path, "r");
-        print f.read();
-        print "-" * 50
+        print("-" * 50)
+        print("Error parsing %s"%file_path)
+        f = open(file_path, "r")
+        print(f.read())
+        print("-" * 50)
         return
 
     testcases = tree.findall(".//testcase")
@@ -64,17 +65,17 @@ def main(report_dir_path):
     for test_report in glob.iglob(report_dir_path + '/*.xml'):
         file_path = os.path.abspath(test_report)
         try:
-            print "Checking %s" % test_report
+            print("Checking %s" % test_report)
             print_error_reports_from_report_file(file_path)
-        except Exception, e:
-            print "Error while reading report file, %s" % file_path
-            print "Exception: %s" % e
+        except Exception as e:
+            print("Error while reading report file, %s" % file_path)
+            print("Exception: %s" % e)
             traceback.print_exc()
 
 
 if __name__ == "__main__":
-    if sys.argv < 2:
-        print "Usage: %s [report dir path]" % sys.argv[0]
+    if len(sys.argv) < 2:
+        print("Usage: %s [report dir path]" % sys.argv[0])
         sys.exit(1)
 
     main(sys.argv[1])

Reply via email to