Skip to content

Commit 2609358

Browse files
committed
Enable 'setup.py test'
1 parent 0470893 commit 2609358

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import platform
1111
import re
1212
import sys
13+
import unittest
1314

1415
import setuptools
1516
from setuptools.command import build_ext as _build_ext
@@ -26,6 +27,12 @@
2627
LDFLAGS.append('ws2_32.lib')
2728

2829

30+
def discover_tests():
31+
test_loader = unittest.TestLoader()
32+
test_suite = test_loader.discover('tests', pattern='test_*.py')
33+
return test_suite
34+
35+
2936
class build_ext(_build_ext.build_ext):
3037
user_options = _build_ext.build_ext.user_options + [
3138
('cython-always', None,
@@ -193,4 +200,5 @@ def _patch_cfile(self, cfile):
193200
extra_link_args=LDFLAGS)
194201
],
195202
cmdclass={'build_ext': build_ext},
203+
test_suite='setup.discover_tests',
196204
)

0 commit comments

Comments
 (0)