55from urllib .request import urlopen
66
77from setuptools import setup
8- from setuptools .command .install import install
8+ from setuptools .command .install import install as InstallCommand
9+ from setuptools .command .test import test as TestCommand
910
1011
1112version = '0.3.8'
1617 long_description = f .read ()
1718
1819
19- class PostInstallCommand (install ):
20+ class PostInstallCommand (InstallCommand ):
2021 """Post-installation for installation mode."""
2122
2223 def run (self ):
@@ -51,11 +52,22 @@ def run(self):
5152 with open (dist , 'wb' ) as f :
5253 built_lib = urlopen (download_url ).read ()
5354 f .write (built_lib )
54- install .run (self )
55+ InstallCommand .run (self )
56+
57+
58+ class PyTestCommand (TestCommand ):
59+ user_options = []
60+
61+ def run (self ):
62+ self .run_command ('test_rust' )
63+
64+ import subprocess
65+
66+ subprocess .check_call ([sys .executable , '-m' , 'pytest' , 'tests' ])
5567
5668
5769install_requires = ['wheel' ]
58- tests_require = install_requires + ['nose ' ]
70+ tests_require = install_requires + ['pytest' , 'pytest-benchmark ' ]
5971
6072setup (
6173 name = 'py-sourcemap' ,
@@ -79,9 +91,9 @@ def run(self):
7991 ],
8092 install_requires = install_requires ,
8193 tests_require = tests_require ,
82- test_suite = 'nose.collector' ,
8394 cmdclass = {
8495 'install' : PostInstallCommand ,
96+ # 'test': PyTestCommand,
8597 },
8698 # rust extensions are not zip safe, just like C-extensions.
8799 zip_safe = False )
0 commit comments