diff options
Diffstat (limited to 'src/tests/pysss_murmur-test.py')
-rwxr-xr-x | src/tests/pysss_murmur-test.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/tests/pysss_murmur-test.py b/src/tests/pysss_murmur-test.py index 0b28f45e6..faa8bb2d3 100755 --- a/src/tests/pysss_murmur-test.py +++ b/src/tests/pysss_murmur-test.py @@ -23,10 +23,9 @@ import unittest import sys import os import copy +import errno -srcdir = os.getenv('builddir') -if not srcdir: - srcdir = "." +srcdir = os.getenv('builddir') or "." MODPATH = srcdir + "/.libs" #FIXME - is there a way to get this from libtool? def compat_assertItemsEqual(this, expected_seq, actual_seq, msg=None): @@ -57,6 +56,23 @@ class PySssMurmurImport(unittest.TestCase): def testImport(self): " Import the module and assert it comes from tree " try: + cwd_backup = os.getcwd() + + try: + os.unlink(MODPATH + "/pysss_murmur.so") + except OSError as e: + if e.errno == errno.ENOENT: + pass + else: + raise e + + os.chdir(MODPATH) + if sys.version_info[0] > 2: + os.symlink("_py3sss_murmur.so", "pysss_murmur.so") + else: + os.symlink("_py2sss_murmur.so", "pysss_murmur.so") + os.chdir(cwd_backup) + import pysss_murmur except ImportError as e: print("Could not load the pysss_murmur module. Please check if it is compiled", file=sys.stderr) |