[pypy-commit] cffi default: (lazka) improve the test, and fix a typo (bad arigo)
arigo
noreply at buildbot.pypy.org
Fri Feb 22 16:40:30 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1165:54a7e200479b
Date: 2013-02-22 16:40 +0100
http://bitbucket.org/cffi/cffi/changeset/54a7e200479b/
Log: (lazka) improve the test, and fix a typo (bad arigo)
diff --git a/testing/test_function.py b/testing/test_function.py
--- a/testing/test_function.py
+++ b/testing/test_function.py
@@ -1,6 +1,7 @@
import py
from cffi import FFI
import math, os, sys
+import ctypes.util
from cffi.backend_ctypes import CTypesBackend
from testing.udir import udir
@@ -70,13 +71,18 @@
assert x is None
def test_dlopen_filename(self):
- if not os.path.exists('/ib/libm.so.6'):
- py.test.skip("/lib/libm.so.6 does not exist")
+ path = ctypes.util.find_library("m")
+ if not path:
+ py.test.skip("libm not found")
ffi = FFI(backend=self.Backend())
ffi.cdef("""
double cos(double x);
""")
- m = ffi.dlopen("/lib/libm.so.6")
+ m = ffi.dlopen(path)
+ x = m.cos(1.23)
+ assert x == math.cos(1.23)
+
+ m = ffi.dlopen(os.path.basename(path))
x = m.cos(1.23)
assert x == math.cos(1.23)
More information about the pypy-commit
mailing list