From 341a00311680a440d7f979f06c34c70d86c9367a Mon Sep 17 00:00:00 2001 From: Bohuslav Kabrda Date: Fri, 12 Dec 2014 11:04:40 +0100 Subject: Python3 support in SSSD https://fedorahosted.org/sssd/ticket/2017 --- src/tests/pyhbac-test.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/tests/pyhbac-test.py') diff --git a/src/tests/pyhbac-test.py b/src/tests/pyhbac-test.py index c4228368a..b7f27026b 100755 --- a/src/tests/pyhbac-test.py +++ b/src/tests/pyhbac-test.py @@ -1,15 +1,20 @@ #!/usr/bin/python2 +from __future__ import print_function import unittest import sys import os import copy +import sys srcdir = os.getenv('builddir') if not srcdir: srcdir = "." MODPATH = srcdir + "/.libs" #FIXME - is there a way to get this from libtool? +if sys.version_info[0] > 2: + unicode = str + def compat_assertItemsEqual(this, expected_seq, actual_seq, msg=None): return this.assertEqual(sorted(expected_seq), sorted(actual_seq)) @@ -37,8 +42,8 @@ class PyHbacImport(unittest.TestCase): " Import the module and assert it comes from tree " try: import pyhbac - except ImportError, e: - print >>sys.stderr, "Could not load the pyhbac module. Please check if it is compiled" + except ImportError as e: + print("Could not load the pyhbac module. Please check if it is compiled", file=sys.stderr) raise e self.assertEqual(pyhbac.__file__, MODPATH + "/pyhbac.so") -- cgit