Author: Armin Rigo <[email protected]>
Branch:
Changeset: r77637:a9b88b2d9e30
Date: 2015-05-28 10:24 +0200
http://bitbucket.org/pypy/pypy/changeset/a9b88b2d9e30/
Log: import cffi/c0ca172d6ce6
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py
b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py
@@ -32,9 +32,23 @@
def run(self, args):
env = os.environ.copy()
- env['PYTHONPATH'] = self.rootdir
+ newpath = self.rootdir
+ if 'PYTHONPATH' in env:
+ newpath += os.pathsep + env['PYTHONPATH']
+ env['PYTHONPATH'] = newpath
subprocess.check_call([self.executable] + args, env=env)
+ def _prepare_setuptools(self):
+ if hasattr(TestDist, '_setuptools_ready'):
+ return
+ try:
+ import setuptools
+ except ImportError:
+ py.test.skip("setuptools not found")
+ subprocess.check_call([self.executable, 'setup.py', 'egg_info'],
+ cwd=self.rootdir)
+ TestDist._setuptools_ready = True
+
def check_produced_files(self, content, curdir=None):
if curdir is None:
curdir = str(self.udir)
@@ -44,6 +58,8 @@
name.endswith('.dylib')):
found_so = os.path.join(curdir, name)
name = name.split('.')[0] + '.SO' # foo.cpython-34m.so =>
foo.SO
+ if name.startswith('pycparser') and name.endswith('.egg'):
+ continue # no clue why this shows up sometimes and not
others
assert name in content, "found unexpected file %r" % (
os.path.join(curdir, name),)
value = content.pop(name)
@@ -189,7 +205,9 @@
ext = ffi.distutils_extension()
self.check_produced_files({'build': {
'mod_name_in_package': {'mymod.c': None}}})
- assert ext.sources[0].endswith('build/mod_name_in_package/mymod.c')
+ if hasattr(os.path, 'samefile'):
+ assert os.path.samefile(ext.sources[0],
+ 'build/mod_name_in_package/mymod.c')
@from_outside
def test_api_distutils_extension_2(self):
@@ -198,7 +216,9 @@
ext = ffi.distutils_extension(str(self.udir.join('foo')))
self.check_produced_files({'foo': {
'mod_name_in_package': {'mymod.c': None}}})
- assert ext.sources[0].endswith('foo/mod_name_in_package/mymod.c')
+ if hasattr(os.path, 'samefile'):
+ assert os.path.samefile(ext.sources[0],
+ str(self.udir.join('foo/mod_name_in_package/mymod.c')))
def _make_distutils_api(self):
@@ -238,6 +258,7 @@
'mymod.SO': None}}})
def _make_setuptools_abi(self):
+ self._prepare_setuptools()
os.mkdir("src0")
os.mkdir(os.path.join("src0", "pack2"))
with open(os.path.join("src0", "pack2", "__init__.py"), "w") as f:
@@ -277,6 +298,7 @@
'mymod.py': None}}})
def _make_setuptools_api(self):
+ self._prepare_setuptools()
os.mkdir("src1")
os.mkdir(os.path.join("src1", "pack3"))
with open(os.path.join("src1", "pack3", "__init__.py"), "w") as f:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit