diff options
| author | Paul Ganssle <paul@ganssle.io> | 2019-10-22 10:00:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-22 10:00:53 -0400 |
| commit | a768f8d22a2c41af8163546b291b1f60d424dcc1 (patch) | |
| tree | 75eeb07a60042f8fe4ff608c37d1bbe3cd6c460a /setuptools | |
| parent | 1362c8c37355f74b5aa9a8afb749aa9464bb58fb (diff) | |
| parent | cd84510713ada48bf33d4efa749c2952e3fc1a49 (diff) | |
| download | python-setuptools-git-a768f8d22a2c41af8163546b291b1f60d424dcc1.tar.gz | |
Merge pull request #1878 from jdufresne/deprecate-test-suite
Deprecate the test command
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/command/test.py | 10 | ||||
| -rw-r--r-- | setuptools/tests/test_test.py | 50 |
2 files changed, 59 insertions, 1 deletions
diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 973e4eb2..c148b38d 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -74,7 +74,7 @@ class NonDataProperty: class test(Command): """Command to run unit tests after in-place build""" - description = "run unit tests after in-place build" + description = "run unit tests after in-place build (deprecated)" user_options = [ ('test-module=', 'm', "Run 'test_suite' in specified module"), @@ -214,6 +214,14 @@ class test(Command): return itertools.chain(ir_d, tr_d, er_d) def run(self): + self.announce( + "WARNING: Testing via this command is deprecated and will be " + "removed in a future version. Users looking for a generic test " + "entry point independent of test runner are encouraged to use " + "tox.", + log.WARN, + ) + installed_dists = self.install_dists(self.distribution) cmd = ' '.join(self._argv) diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index faaa6ba9..382bd640 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals +import mock from distutils import log import os @@ -124,3 +125,52 @@ def test_tests_are_run_once(capfd): cmd.run() out, err = capfd.readouterr() assert out == 'Foo\n' + + +@pytest.mark.usefixtures('sample_test') +def test_warns_deprecation(capfd): + params = dict( + name='foo', + packages=['name', 'name.space', 'name.space.tests'], + namespace_packages=['name'], + test_suite='name.space.tests.test_suite', + use_2to3=True + ) + dist = Distribution(params) + dist.script_name = 'setup.py' + cmd = test(dist) + cmd.ensure_finalized() + cmd.announce = mock.Mock() + cmd.run() + capfd.readouterr() + msg = ( + "WARNING: Testing via this command is deprecated and will be " + "removed in a future version. Users looking for a generic test " + "entry point independent of test runner are encouraged to use " + "tox." + ) + cmd.announce.assert_any_call(msg, log.WARN) + + +@pytest.mark.usefixtures('sample_test') +def test_deprecation_stderr(capfd): + params = dict( + name='foo', + packages=['name', 'name.space', 'name.space.tests'], + namespace_packages=['name'], + test_suite='name.space.tests.test_suite', + use_2to3=True + ) + dist = Distribution(params) + dist.script_name = 'setup.py' + cmd = test(dist) + cmd.ensure_finalized() + cmd.run() + out, err = capfd.readouterr() + msg = ( + "WARNING: Testing via this command is deprecated and will be " + "removed in a future version. Users looking for a generic test " + "entry point independent of test runner are encouraged to use " + "tox.\n" + ) + assert msg in err |
