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

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 4287b7ae2 PROTON-2814: [Python] Tests use function removed in Python 
3.12
4287b7ae2 is described below

commit 4287b7ae2b9bdb19f3040c82d298ec764b5e4acd
Author: Andrew Stitcher <astitc...@apache.org>
AuthorDate: Mon Apr 15 13:33:57 2024 -0400

    PROTON-2814: [Python] Tests use function removed in Python 3.12
    
    Fix changed cgi.escape() to html.escape() as cgi.escape has been removed
    in Python 3.12.
    
    This only affects test failure output in the JUnit reporter so would
    only get noticed if there was a test failure in this mode.
---
 python/tests/proton_tests/main.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/python/tests/proton_tests/main.py 
b/python/tests/proton_tests/main.py
index 15a0effa7..f2d518fb3 100644
--- a/python/tests/proton_tests/main.py
+++ b/python/tests/proton_tests/main.py
@@ -26,7 +26,7 @@ import sys
 import time
 import traceback
 import types
-import cgi
+import html
 from fnmatch import fnmatchcase as match
 from logging import getLogger, StreamHandler, Formatter, Filter, \
     WARN, DEBUG, ERROR, INFO
@@ -235,9 +235,9 @@ class JunitXmlStyleReporter:
         module = '.'.join(parts[0:-1])
         self.f.write('<testcase classname="%s" name="%s" time="%f">\n' % 
(module, method, result.time))
         if result.failed:
-            escaped_type = cgi.escape(str(result.exception_type))
-            escaped_message = cgi.escape(str(result.exception_message))
-            self.f.write('<failure type="%s" message="%s">\n' % (escaped_type, 
escaped_message))
+            escaped_type = html.escape(str(result.exception_type), quote=True)
+            escaped_message = html.escape(str(result.exception_message), 
quote=True)
+            self.f.write(f'<failure type="{escaped_type}" 
message="{escaped_message}">\n')
             self.f.write('<![CDATA[\n')
             self.f.write(result.formatted_exception_trace)
             self.f.write(']]>\n')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to