Skip to content

Commit d6dbddc

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

File tree

2 files changed

+45
-0
lines changed

2 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

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

0 commit comments

Comments
 (0)