diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-10-19 08:39:30 -0700 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2019-10-21 17:32:25 -0700 |
commit | cd84510713ada48bf33d4efa749c2952e3fc1a49 (patch) | |
tree | 75eeb07a60042f8fe4ff608c37d1bbe3cd6c460a /setuptools/tests/test_test.py | |
parent | 1362c8c37355f74b5aa9a8afb749aa9464bb58fb (diff) | |
download | external_python_setuptools-cd84510713ada48bf33d4efa749c2952e3fc1a49.tar.gz external_python_setuptools-cd84510713ada48bf33d4efa749c2952e3fc1a49.tar.bz2 external_python_setuptools-cd84510713ada48bf33d4efa749c2952e3fc1a49.zip |
Deprecate the test command
Provide a warning to users. Suggest using tox as an alternative generic
entry point.
Refs #1684
Diffstat (limited to 'setuptools/tests/test_test.py')
-rw-r--r-- | setuptools/tests/test_test.py | 50 |
1 files changed, 50 insertions, 0 deletions
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 |