Commits

Armin Rigo  committed 9730bd3

Try harder to run the tests even if PYTHONPATH was not set and cffi not
installed. Tested with a "python setup.py build_ext -i" as well as with
a fresh "python setup.py install".

  • Participants
  • Parent commits 3643242

Comments (0)

Files changed (4)

 import py
+def _setup_path():
+    import os, sys
+    sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
+_setup_path()
 from _cffi_backend import *
 from _cffi_backend import _testfunc, _get_types
 

File testing/callback_in_thread.py

-import time
+import sys, time
+sys.path.insert(0, sys.argv[1])
 from cffi import FFI
 
 def _run_callback_in_thread():

File testing/test_verify.py

 def test_callback_in_thread():
     if sys.platform == 'win32':
         py.test.skip("pthread only")
-    import os, subprocess
+    import os, subprocess, imp
     arg = os.path.join(os.path.dirname(__file__), 'callback_in_thread.py')
-    g = subprocess.Popen([sys.executable, arg])
+    g = subprocess.Popen([sys.executable, arg,
+                          os.path.dirname(imp.find_module('cffi')[1])])
     result = g.wait()
     assert result == 0
 

File testing/test_zintegration.py

             site_packages = dirpath
             break
     if site_packages:
-        for module in ('pycparser', 'ply'):
-            os.symlink(imp.find_module(module)[1],
-                       os.path.join(site_packages, module))
-
+        for module in ('cffi', '_cffi_backend', 'pycparser', 'ply'):
+            target = imp.find_module(module)[1]
+            os.symlink(target, os.path.join(site_packages,
+                                            os.path.basename(target)))
     return tmpdir
 
 SNIPPET_DIR = py.path.local(__file__).join('..', 'snippets')