10
10
import platform
11
11
import re
12
12
import sys
13
- import unittest
14
13
15
14
import setuptools
16
15
from setuptools .command import build_ext as _build_ext
29
28
CFLAGS .extend (['-Wall' , '-Wsign-compare' , '-Wconversion' ])
30
29
31
30
32
- def discover_tests ():
33
- test_loader = unittest .TestLoader ()
34
- test_suite = test_loader .discover ('tests' , pattern = 'test_*.py' )
35
- return test_suite
36
-
37
-
38
31
class build_ext (_build_ext .build_ext ):
39
32
user_options = _build_ext .build_ext .user_options + [
40
33
('cython-always' , None ,
@@ -46,12 +39,24 @@ class build_ext(_build_ext.build_ext):
46
39
]
47
40
48
41
def initialize_options (self ):
42
+ # initialize_options() may be called multiple times on the
43
+ # same command object, so make sure not to override previously
44
+ # set options.
45
+ if getattr (self , '_initialized' , False ):
46
+ return
47
+
49
48
super (build_ext , self ).initialize_options ()
50
49
self .cython_always = False
51
50
self .cython_annotate = None
52
51
self .cython_directives = None
53
52
54
53
def finalize_options (self ):
54
+ # finalize_options() may be called multiple times on the
55
+ # same command object, so make sure not to override previously
56
+ # set options.
57
+ if getattr (self , '_initialized' , False ):
58
+ return
59
+
55
60
need_cythonize = self .cython_always
56
61
cfiles = {}
57
62
@@ -209,5 +214,5 @@ def _patch_cfile(self, cfile):
209
214
extra_link_args = LDFLAGS )
210
215
],
211
216
cmdclass = {'build_ext' : build_ext },
212
- test_suite = 'setup.discover_tests ' ,
217
+ test_suite = 'tests.suite ' ,
213
218
)
0 commit comments