Skip to content

Commit

Permalink
Restore the tests command and deprecate access to the module.
Browse files Browse the repository at this point in the history
Closes #4520; Closes #4519.
  • Loading branch information
jaraco committed Jul 29, 2024
1 parent 5e1b3c4 commit d6dbddc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions newsfragments/4520.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore the tests command and deprecate access to the module. (#4519)
44 changes: 44 additions & 0 deletions setuptools/command/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import datetime

from setuptools import Command
from setuptools.warnings import SetuptoolsDeprecationWarning


def __getattr__(name):
SetuptoolsDeprecationWarning.emit(
"The test command is disabled and references to it are deprecated.",
"Please remove any references to `setuptools.command.test` in all "
"supported versions of the affected package.",
due_date=datetime.date(2024, 11, 15),
stacklevel=2,
)
if name == 'test':
return _test
raise AttributeError(name)


class _test(Command):
"""
Stub to warn when test command is referenced or used.
"""

description = "stub for old test command (do not use)"

user_options = [
('test-module=', 'm', "Run 'test_suite' in specified module"),
(
'test-suite=',
's',
"Run single test, case or suite (e.g. 'module.test_suite')",
),
('test-runner=', 'r', "Test runner to use"),
]

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
raise RuntimeError("Support for the test command was removed in Setuptools 72")

0 comments on commit d6dbddc

Please sign in to comment.