[pypy-commit] cffi default: Try harder to run the tests even if PYTHONPATH was not set and cffi not
arigo
noreply at buildbot.pypy.org
Tue Jan 1 11:01:54 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1107:9730bd3cf1da
Date: 2013-01-01 10:55 +0100
http://bitbucket.org/cffi/cffi/changeset/9730bd3cf1da/
Log: 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".
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -1,4 +1,8 @@
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
diff --git a/testing/callback_in_thread.py b/testing/callback_in_thread.py
--- a/testing/callback_in_thread.py
+++ b/testing/callback_in_thread.py
@@ -1,4 +1,5 @@
-import time
+import sys, time
+sys.path.insert(0, sys.argv[1])
from cffi import FFI
def _run_callback_in_thread():
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -1276,9 +1276,10 @@
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
diff --git a/testing/test_zintegration.py b/testing/test_zintegration.py
--- a/testing/test_zintegration.py
+++ b/testing/test_zintegration.py
@@ -17,10 +17,10 @@
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')
More information about the pypy-commit
mailing list