This commit is contained in:
parent
627dbee2e8
commit
15e4c2a51e
@ -1,42 +0,0 @@
|
||||
From: Michal Vyskocil <mvyskocil@suse.com>
|
||||
Subject: Py.test integration
|
||||
|
||||
... to allow python setup.py test
|
||||
|
||||
---
|
||||
setup.py | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: cffi-0.8/setup.py
|
||||
===================================================================
|
||||
--- cffi-0.8.orig/setup.py
|
||||
+++ cffi-0.8/setup.py
|
||||
@@ -2,6 +2,19 @@ import sys, os
|
||||
import subprocess
|
||||
import errno
|
||||
|
||||
+# http://pytest.org/latest/goodpractises.html
|
||||
+from setuptools.command.test import test as TestCommand
|
||||
+
|
||||
+class PyTest(TestCommand):
|
||||
+ def finalize_options(self):
|
||||
+ TestCommand.finalize_options(self)
|
||||
+ self.test_args = ['testing/', ]
|
||||
+ self.test_suite = True
|
||||
+ def run_tests(self):
|
||||
+ #import here, cause outside the eggs aren't loaded
|
||||
+ import pytest
|
||||
+ errno = pytest.main(self.test_args)
|
||||
+ sys.exit(errno)
|
||||
|
||||
sources = ['c/_cffi_backend.c']
|
||||
libraries = ['ffi']
|
||||
@@ -132,5 +145,7 @@ Contact
|
||||
|
||||
install_requires=[
|
||||
'pycparser',
|
||||
- ]
|
||||
+ ],
|
||||
+ tests_require=['pytest'],
|
||||
+ cmdclass = {'test': PyTest},
|
||||
)
|
@ -1,71 +0,0 @@
|
||||
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()
|
@ -24,8 +24,6 @@ License: MIT
|
||||
Group: Development/Languages/Python
|
||||
Url: http://cffi.readthedocs.org
|
||||
Source0: http://pypi.python.org/packages/source/c/cffi/cffi-%{version}.tar.gz
|
||||
#PATCH-FOR-UPSTREAM: integration with setuptools, mvyskocil@suse.com
|
||||
Patch0: cffi-pytest-integration.patch
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-setuptools
|
||||
# Documentation requirements:
|
||||
@ -47,7 +45,6 @@ is to provide a convenient and reliable way of calling C code from Python.
|
||||
|
||||
%prep
|
||||
%setup -q -n cffi-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
CFLAGS="%{optflags}" python setup.py build
|
||||
@ -56,9 +53,8 @@ python setup.py build_sphinx && rm build/sphinx/html/.buildinfo
|
||||
%install
|
||||
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||||
|
||||
#mvyskocil: some test assume distutils beeing available, fix that later
|
||||
#%check
|
||||
#python setup.py test
|
||||
%check
|
||||
PYTHONPATH=%{buildroot}%{python_sitearch} py.test
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
|
Loading…
x
Reference in New Issue
Block a user