Skip to content

Commit 59aff44

Browse files
authored
Merge pull request #4522 from pypa/feature/graceful-drop-tests
Restore the tests command and deprecate access to the module.
2 parents 5e1b3c4 + c437aaa commit 59aff44

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

newsfragments/4520.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Restore the tests command and deprecate access to the module. (#4519)

setuptools/command/test.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from setuptools import Command
2+
from setuptools.warnings import SetuptoolsDeprecationWarning
3+
4+
5+
def __getattr__(name):
6+
if name == 'test':
7+
SetuptoolsDeprecationWarning.emit(
8+
"The test command is disabled and references to it are deprecated.",
9+
"Please remove any references to `setuptools.command.test` in all "
10+
"supported versions of the affected package.",
11+
due_date=(2024, 11, 15),
12+
stacklevel=2,
13+
)
14+
return _test
15+
raise AttributeError(name)
16+
17+
18+
class _test(Command):
19+
"""
20+
Stub to warn when test command is referenced or used.
21+
"""
22+
23+
description = "stub for old test command (do not use)"
24+
25+
user_options = [
26+
('test-module=', 'm', "Run 'test_suite' in specified module"),
27+
(
28+
'test-suite=',
29+
's',
30+
"Run single test, case or suite (e.g. 'module.test_suite')",
31+
),
32+
('test-runner=', 'r', "Test runner to use"),
33+
]
34+
35+
def initialize_options(self):
36+
pass
37+
38+
def finalize_options(self):
39+
pass
40+
41+
def run(self):
42+
raise RuntimeError("Support for the test command was removed in Setuptools 72")

setuptools/tests/integration/test_pip_install_sdist.py

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
("pyyaml", LATEST), # cython + custom build_ext + custom distclass
5555
("charset-normalizer", LATEST), # uses mypyc, used by aiohttp
5656
("protobuf", LATEST),
57+
("requests", LATEST),
58+
("celery", LATEST),
5759
# When adding packages to this list, make sure they expose a `__version__`
5860
# attribute, or modify the tests below
5961
]

0 commit comments

Comments
 (0)