diff --git a/NEWS b/NEWS index c7eb4864..34d0a7cb 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ Improvements * Add support for Python 3.10. (Jürgen Gmach) +* Distutils integration is deprecated and will be removed in the next major + version. + 2.5.0 ~~~~~ diff --git a/doc/for-test-authors.rst b/doc/for-test-authors.rst index 90bd3cac..52611544 100644 --- a/doc/for-test-authors.rst +++ b/doc/for-test-authors.rst @@ -92,6 +92,14 @@ From now on, we'll assume that you know how to run your tests. Running test with Distutils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. deprecated:: 2.6.0 + + Distutils integration was deprecated in 2.6.0. You should consider + replacing invocations of ``python setup.py test`` with a suitable + alternative such as ``tox``. Refer to `this issue`__ for more information. + + .. __: https://github.com/pypa/setuptools/issues/1684 + If you are using Distutils_ to build your Python project, you can use the testtools Distutils_ command to integrate testtools into your Distutils_ workflow:: diff --git a/testtools/distutilscmd.py b/testtools/distutilscmd.py index a4d79dc8..eedc4ff2 100644 --- a/testtools/distutilscmd.py +++ b/testtools/distutilscmd.py @@ -3,6 +3,7 @@ """Extensions to the standard Python unittest library.""" import sys +import warnings from distutils.core import Command from distutils.errors import DistutilsOptionError @@ -19,8 +20,8 @@ class TestCommand(Command): ('catch', 'c', "Catch ctrl-C and display results so far"), ('buffer', 'b', "Buffer stdout and stderr during tests"), ('failfast', 'f', "Stop on first fail or error"), - ('test-module=','m', "Run 'test_suite' in specified module"), - ('test-suite=','s', + ('test-module=', 'm', "Run 'test_suite' in specified module"), + ('test-suite=', 's', "Test suite to run (e.g. 'some_module.test_suite')") ] @@ -28,6 +29,13 @@ def __init__(self, dist): Command.__init__(self, dist) self.runner = TestToolsTestRunner(stdout=sys.stdout) + warnings.warn( + "Distutils integration is deprecated and will be removed in the " + "next major release. " + "Refer to https://github.com/pypa/setuptools/issues/1684 for more " + "information.", + DeprecationWarning, + ) def initialize_options(self): self.test_suite = None