Skip to content

Commit c437aaa

Browse files
committed
Restore the tests command and deprecate access to the module.
Closes #4520; Closes #4519.
1 parent a6726b9 commit c437aaa

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-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")

0 commit comments

Comments
 (0)