[Git][reproducible-builds/diffoscope][master] setup.py: drop deprecated and no longer functional "setup.py test" command

Eli Schwartz (@eschwartz) gitlab at salsa.debian.org
Tue Mar 4 11:20:14 UTC 2025



Eli Schwartz pushed to branch master at Reproducible Builds / diffoscope


Commits:
a49c25d8 by Eli Schwartz at 2025-02-25T05:57:48-05:00
setup.py: drop deprecated and no longer functional "setup.py test" command

If you try to use it for the last year, you get this fatal error:

```
/usr/lib/python3.12/site-packages/setuptools/_distutils/dist.py:270: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
running test
[...]
RuntimeError: Support for the test command was removed in Setuptools 72
```

All it did was allow you to do the same thing you could already do via
`pytest` except that in theory it permitted you to have setuptools
download and inject an egg of pytest into the local source tree before
launching pytest itself. By and large, nobody used it, instead using
pytest directly. None of diffoscope's own packaging utilized it either.

It also annoyed me in Gentoo packaging every time I built it:

```
 * QA Notice: setuptools warnings detected:
 *
 * 	Unknown distribution option: 'tests_require'
```

Signed-off-by: Eli Schwartz <eschwartz at gentoo.org>

- - - - -


1 changed file:

- setup.py


Changes:

=====================================
setup.py
=====================================
@@ -5,7 +5,6 @@ import json
 import sys
 
 from setuptools import setup, find_packages
-from setuptools.command.test import test as TestCommand
 
 
 if sys.version_info < (3, 7):
@@ -13,26 +12,6 @@ if sys.version_info < (3, 7):
     sys.exit(1)
 
 
-class PyTest(TestCommand):
-    user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
-
-    def initialize_options(self):
-        super().initialize_options()
-        self.pytest_args = []
-
-    def finalize_options(self):
-        super().finalize_options()
-        if self.pytest_args:
-            self.pytest_args = [self.pytest_args]
-
-    def run_tests(self):
-        # Inline import, otherwise the eggs aren't loaded
-        import pytest
-
-        errno = pytest.main(self.pytest_args)
-        sys.exit(errno)
-
-
 # Load extras_require dict from external JSON file. This allows it to be easily
 # shared by the debian/tests/generate-recommends.py script.
 with open("extras_require.json") as f:
@@ -50,8 +29,6 @@ setup(
     url="https://diffoscope.org/",
     packages=find_packages(exclude=["tests", "tests.*"]),
     package_data={"diffoscope": ["scripts/*"]},
-    tests_require=["pytest"],
-    cmdclass={"test": PyTest},
     entry_points={
         "console_scripts": ["diffoscope=diffoscope.main:main"],
     },



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/a49c25d85869eba64d90b3b4c6a64eca4292a39e

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/a49c25d85869eba64d90b3b4c6a64eca4292a39e
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20250304/84d33ef4/attachment.htm>


More information about the rb-commits mailing list