def test_compile_module(self):
     ffi = FFI()
     ffi.cdef("double sin(double x);")
     csrc = '/*hi there %s!*/\n#include <math.h>\n' % self
     v = Verifier(ffi, csrc, force_generic_engine=self.generic)
     v.compile_module()
     assert v.get_module_name().startswith('_cffi_')
     if v.generates_python_module():
         mod = imp.load_dynamic(v.get_module_name(), v.modulefilename)
         assert hasattr(mod, '_cffi_setup')
 def test_compile_module(self):
     ffi = FFI()
     ffi.cdef("double sin(double x);")
     csrc = '/*hi there %s!*/\n#include <math.h>\n' % self
     v = Verifier(ffi, csrc, force_generic_engine=self.generic)
     v.compile_module()
     assert v.get_module_name().startswith('_cffi_')
     if v.generates_python_module():
         mod = imp.load_dynamic(v.get_module_name(), v.modulefilename)
         assert hasattr(mod, '_cffi_setup')
 def test_compile_module_explicit_filename(self):
     ffi = FFI()
     ffi.cdef("double sin(double x);")
     csrc = '/*hi there %s!2*/\n#include <math.h>\n' % self
     v = Verifier(ffi, csrc, force_generic_engine=self.generic)
     basename = self.__class__.__name__ + 'test_compile_module'
     v.modulefilename = filename = str(udir.join(basename + '.so'))
     v.compile_module()
     assert filename == v.modulefilename
     assert v.get_module_name() == basename
     if v.generates_python_module():
         mod = imp.load_dynamic(v.get_module_name(), v.modulefilename)
         assert hasattr(mod, '_cffi_setup')
 def test_compile_module_explicit_filename(self):
     ffi = FFI()
     ffi.cdef("double sin(double x);")
     csrc = '/*hi there %s!2*/\n#include <math.h>\n' % self
     v = Verifier(ffi, csrc, force_generic_engine=self.generic)
     basename = self.__class__.__name__ + 'test_compile_module'
     v.modulefilename = filename = str(udir.join(basename + '.so'))
     v.compile_module()
     assert filename == v.modulefilename
     assert v.get_module_name() == basename
     if v.generates_python_module():
         mod = imp.load_dynamic(v.get_module_name(), v.modulefilename)
         assert hasattr(mod, '_cffi_setup')