forked from pool/python-cffi
- update to 0.8.1 * fixes on Python 3 on OS/X, and some FreeBSD fixes (thanks Tobias) - added a note wrt disabled tests - add cffi-pytest-integration.patch: allowinf call pytest from setup.py - update to 0.8 * integrated support for C99 variable-sized structures * multi-thread safety * ffi.getwinerror() * a number of small fixes OBS-URL: https://build.opensuse.org/request/show/223704 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=8
72 lines
2.7 KiB
Diff
72 lines
2.7 KiB
Diff
From: Michal Vyskocil <mvyskocil@suse.com>
|
|
Subject: Skip distutils tests
|
|
|
|
... when setuptools is installed.
|
|
|
|
It seems that recent setuptools override distutils, which ends with such errors
|
|
ext = v.get_extension()
|
|
> assert 'distutils.extension.Extension' in str(ext.__class__)
|
|
E assert 'distutils.extension.Extension' in 'setuptools.extension.Extension'
|
|
|
|
---
|
|
testing/test_zdistutils.py | 25 +++++++++++--------------
|
|
1 file changed, 11 insertions(+), 14 deletions(-)
|
|
|
|
Index: cffi-0.8/testing/test_zdistutils.py
|
|
===================================================================
|
|
--- cffi-0.8.orig/testing/test_zdistutils.py
|
|
+++ cffi-0.8/testing/test_zdistutils.py
|
|
@@ -1,25 +1,22 @@
|
|
import sys, os, imp, math, shutil
|
|
import py
|
|
+import pytest
|
|
from cffi import FFI, FFIError
|
|
from cffi.verifier import Verifier, _locate_engine_class, _get_so_suffixes
|
|
from cffi.ffiplatform import maybe_relative_path
|
|
from testing.udir import udir
|
|
|
|
+try:
|
|
+ import setuptools
|
|
+ del setuptools
|
|
+ HAVE_SETUPTOOLS = True
|
|
+except ImportError:
|
|
+ HAVE_SETUPTOOLS = False
|
|
+
|
|
|
|
class DistUtilsTest(object):
|
|
|
|
- def test_locate_engine_class(self):
|
|
- cls = _locate_engine_class(FFI(), self.generic)
|
|
- if self.generic:
|
|
- # asked for the generic engine, which must not generate a
|
|
- # CPython extension module
|
|
- assert not cls._gen_python_module
|
|
- else:
|
|
- # asked for the CPython engine: check that we got it, unless
|
|
- # we are running on top of PyPy, where the generic engine is
|
|
- # always better
|
|
- if '__pypy__' not in sys.builtin_module_names:
|
|
- assert cls._gen_python_module
|
|
+ distname = 'distutils' if not HAVE_SETUPTOOLS else 'setuptools'
|
|
|
|
def test_write_source(self):
|
|
ffi = FFI()
|
|
@@ -143,7 +140,7 @@ class DistUtilsTest(object):
|
|
assert lib.sin(12.3) == math.sin(12.3)
|
|
v = ffi.verifier
|
|
ext = v.get_extension()
|
|
- assert 'distutils.extension.Extension' in str(ext.__class__)
|
|
+ assert '%s.extension.Extension' % self.distname in str(ext.__class__)
|
|
assert ext.sources == [maybe_relative_path(v.sourcefilename)]
|
|
assert ext.name == v.get_module_name()
|
|
assert ext.define_macros == [('TEST_EXTENSION_OBJECT', '1')]
|
|
@@ -171,7 +168,7 @@ class DistUtilsTest(object):
|
|
assert lib.test1eoes(7.0) == 42.0
|
|
v = ffi.verifier
|
|
ext = v.get_extension()
|
|
- assert 'distutils.extension.Extension' in str(ext.__class__)
|
|
+ assert '%s.extension.Extension' % self.distname in str(ext.__class__)
|
|
assert ext.sources == [maybe_relative_path(v.sourcefilename),
|
|
extra_source]
|
|
assert ext.name == v.get_module_name()
|