Fixed some more py3 issues jenkins-wrwp-48
authorAnders Henja <anders@baltrad.eu>
Mon, 3 Feb 2020 13:51:25 +0000 (14:51 +0100)
committerAnders Henja <anders@baltrad.eu>
Mon, 3 Feb 2020 13:51:25 +0000 (14:51 +0100)
test/lib/xmlrunner.py
tools/ci_test.sh

index d7d1a77..ee30037 100644 (file)
@@ -13,11 +13,12 @@ import sys
 import time
 import traceback
 import unittest
-from StringIO import StringIO
-from xml.sax.saxutils import escape
-
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 
+from xml.sax.saxutils import escape
 
 class _TestInfo(object):
 
@@ -168,7 +169,7 @@ class XMLTestRunner(object):
         classname = class_.__module__ + "." + class_.__name__
         if self._stream == None:
             filename = "TEST-%s.xml" % classname
-            stream = file(os.path.join(self._path, filename), "w")
+            stream = open(os.path.join(self._path, filename), "w")
             stream.write('<?xml version="1.0" encoding="utf-8"?>\n')
         else:
             stream = self._stream
index bdd4f25..5e5765d 100755 (executable)
@@ -11,7 +11,7 @@
 #
 # History:  2013-09-17 Created by Anders Henja
 ############################################################
-SCRFILE=`python -c "import os;print os.path.abspath(\"$0\")"`
+SCRFILE=`python -c "import os;print(os.path.abspath(\"$0\"))"`
 SCRIPTPATH=`dirname "$SCRFILE"`
 
 "$SCRIPTPATH/run_python_script.sh" "${SCRIPTPATH}/../test/pytest/WrwpXmlTestSuite.py" "${SCRIPTPATH}/../test/pytest"