]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix some broken tests for Python 3 814/head
authorRobbie Harwood <rharwood@redhat.com>
Mon, 16 Jul 2018 20:44:01 +0000 (16:44 -0400)
committerGreg Hudson <ghudson@mit.edu>
Wed, 18 Jul 2018 19:57:37 +0000 (15:57 -0400)
Remove python2 dependencies in .travis.yml and add python3-paste.
Convert t_daemon.py and jsonwalker.py to python3.  csjon has no
python3 version, so replace it with python's built-in JSON module.

python3-pyrad isn't available for Trusty, so krad and OTP tests are
currently not exercised by Travis.

[ghudson@mit.edu: squashed commits; edited commit message]

ticket: 8710

.travis.yml
src/lib/krad/t_daemon.py
src/tests/jsonwalker.py

index a7980d7e4ae1ab08d26d5d63506f1cd13ee10abe..f0938996b1eb035ac5407a405089d0b4d1dcea99 100644 (file)
@@ -10,7 +10,7 @@ matrix:
 
 before_install:
   - sudo apt-get update -qq
-  - sudo apt-get install -y bison dejagnu gettext keyutils ldap-utils libldap2-dev libkeyutils-dev libssl-dev python-cjson python-paste python-pyrad slapd tcl-dev tcsh
+  - sudo apt-get install -y bison dejagnu gettext keyutils ldap-utils libldap2-dev libkeyutils-dev libssl-dev python3-paste slapd tcl-dev tcsh
   - mkdir -p cmocka/build
   - cd cmocka
   - wget https://cmocka.org/files/1.1/cmocka-1.1.1.tar.xz
index 7d7a5d0c89e38c2e0f10719b387cc05028c80863..7668cd7f87443cd49e0b8e630d165f5c35685aaa 100755 (executable)
@@ -23,7 +23,7 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import StringIO
+from io import StringIO
 import os
 import sys
 import signal
index 7a0675e0830d34828dcd65ec3ac532174439927f..1880363d270dcb221f5f31fe66e8297acda78db9 100644 (file)
@@ -1,10 +1,5 @@
 import sys
-try:
-    import cjson
-except ImportError:
-    print("Warning: skipping audit log verification because the cjson module" \
-          " is unavailable")
-    sys.exit(0)
+import json
 from collections import defaultdict
 from optparse import OptionParser
 
@@ -72,7 +67,7 @@ class Parser(object):
         """
         Generator that works through dictionary.
         """
-        for a,v in adict.iteritems():
+        for a,v in adict.items():
             if isinstance(v,dict):
                 for (attrpath,u) in self._walk(v):
                     yield (a+'.'+attrpath,u)
@@ -93,17 +88,16 @@ if __name__ == '__main__':
         with open(options.filename, 'r') as f:
             content = list()
             for l in f:
-                content.append(cjson.decode(l.rstrip()))
+                content.append(json.loads(l.rstrip()))
         f.close()
     else:
-        print('Input file in jason format is required')
+        print('Input file in JSON format is required')
         exit()
 
     defaults = None
     if options.defaults is not None:
         with open(options.defaults, 'r') as f:
-            defaults = cjson.decode(f.read())
-        f.close()
+            defaults = json.load(f)
 
     # run test
     p = Parser(defaults)