Skip to content

Commit 64c0f6e

Browse files
authored
Remove deprecated use of 'setup.py test' (#307)
Since setuptools v41.5.0 (27 Oct 2019), the 'test' command is formally deprecated and should not be used. Now unify on tox as the default test entry point.
1 parent 6858938 commit 64c0f6e

File tree

4 files changed

+4
-28
lines changed

4 files changed

+4
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ test-all: clean-pyc
115115
$(TOX)
116116

117117
test:
118-
$(PYTHON) setup.py test
118+
tox -e py
119119

120120
cov:
121121
$(NOSETESTS) -xv --with-coverage --cover-html --cover-branch

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ init:
5353

5454
install:
5555
- "powershell appveyor\\install.ps1"
56-
- "%PYTHON%/Scripts/pip.exe install -U setuptools"
56+
- "%PYTHON%/Scripts/pip.exe install tox"
5757

5858
build: off
5959

6060
test_script:
61-
- "%WITH_COMPILER% %PYTHON%/python setup.py test"
61+
- "%WITH_COMPILER% %PYTHON%/python -m tox -e py"
6262

6363
after_test:
6464
- "%WITH_COMPILER% %PYTHON%/python setup.py bdist_wheel"

setup.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import glob
66

77
import setuptools
8-
import setuptools.command.test
98

109
from distutils import sysconfig
1110
from distutils.errors import (
@@ -165,33 +164,12 @@ def add_doc(m):
165164
is_pypy = hasattr(sys, 'pypy_version_info')
166165

167166

168-
def strip_comments(l):
169-
return l.split('#', 1)[0].strip()
170-
171-
172-
def reqs(f):
173-
return list(filter(None, [strip_comments(l) for l in open(
174-
os.path.join(os.getcwd(), 'requirements', f)).readlines()]))
175-
176-
177167
def _is_build_command(argv=sys.argv, cmds=('install', 'build', 'bdist')):
178168
for arg in argv:
179169
if arg.startswith(cmds):
180170
return arg
181171

182172

183-
class pytest(setuptools.command.test.test):
184-
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
185-
186-
def initialize_options(self):
187-
setuptools.command.test.test.initialize_options(self)
188-
self.pytest_args = []
189-
190-
def run_tests(self):
191-
import pytest
192-
sys.exit(pytest.main(self.pytest_args))
193-
194-
195173
def run_setup(with_extensions=True):
196174
extensions = []
197175
if with_extensions:
@@ -233,8 +211,6 @@ def run_setup(with_extensions=True):
233211
url=meta['homepage'],
234212
zip_safe=False,
235213
license='BSD',
236-
tests_require=reqs('test.txt'),
237-
cmdclass={'test': pytest},
238214
classifiers=[
239215
'Development Status :: 5 - Production/Stable',
240216
'Intended Audience :: Developers',

t/integration/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def run(self, *args, **kwargs):
2323
2424
But you can execute the tests by running the command:
2525
26-
$ python setup.py test
26+
$ tox -e py
2727
2828
2929
""")

0 commit comments

Comments
 (0)