Skip to content

Commit

Permalink
Removed support for tests_require and other test command parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jul 5, 2024
1 parent 6929cc4 commit 6404823
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 45 deletions.
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,15 @@ eager_resources = "setuptools.dist:assert_string_list"
namespace_packages = "setuptools.dist:check_nsp"
extras_require = "setuptools.dist:check_extras"
install_requires = "setuptools.dist:check_requirements"
tests_require = "setuptools.dist:check_requirements"
setup_requires = "setuptools.dist:check_requirements"
python_requires = "setuptools.dist:check_specifier"
entry_points = "setuptools.dist:check_entry_points"
test_suite = "setuptools.dist:check_test_suite"
zip_safe = "setuptools.dist:assert_bool"
package_data = "setuptools.dist:check_package_data"
exclude_package_data = "setuptools.dist:check_package_data"
include_package_data = "setuptools.dist:assert_bool"
packages = "setuptools.dist:check_packages"
dependency_links = "setuptools.dist:assert_string_list"
test_loader = "setuptools.dist:check_importable"
test_runner = "setuptools.dist:check_importable"
use_2to3 = "setuptools.dist:invalid_unless_false"

[project.entry-points."egg_info.writers"]
Expand Down
1 change: 0 additions & 1 deletion setuptools/config/setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ def parsers(self):
self._parse_requirements_list, "install_requires"
),
'setup_requires': self._parse_list_semicolon,
'tests_require': self._parse_list_semicolon,
'packages': self._parse_packages,
'entry_points': self._parse_file_in_root,
'py_modules': parse_list,
Expand Down
11 changes: 0 additions & 11 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ def check_entry_points(dist, attr, value):
raise DistutilsSetupError(e) from e


def check_test_suite(dist, attr, value):
if not isinstance(value, str):
raise DistutilsSetupError("test_suite must be a string")


def check_package_data(dist, attr, value):
"""Verify that value is a dictionary of package names to glob lists"""
if not isinstance(value, dict):
Expand Down Expand Up @@ -235,12 +230,6 @@ class Distribution(_Distribution):
EasyInstall and requests one of your extras, the corresponding
additional requirements will be installed if needed.
'test_suite' -- the name of a test suite to run for the 'test' command.
If the user runs 'python setup.py test', the package will be installed,
and the named test suite will be run. The format is the same as
would be used on a 'unittest.py' command line. That is, it is the
dotted name of an object to import and call to generate a test suite.
'package_data' -- a dictionary mapping package names to lists of filenames
or globs to use to find data files contained in the named packages.
If the dictionary has filenames or globs listed under '""' (the empty
Expand Down
1 change: 0 additions & 1 deletion setuptools/tests/config/setupcfg_examples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ https://github.com/pallets/click/raw/6411f425fae545f42795665af4162006b36c5e4a/se
https://github.com/sqlalchemy/sqlalchemy/raw/533f5718904b620be8d63f2474229945d6f8ba5d/setup.cfg
https://github.com/pytest-dev/pluggy/raw/461ef63291d13589c4e21aa182cd1529257e9a0a/setup.cfg
https://github.com/pytest-dev/pytest/raw/c7be96dae487edbd2f55b561b31b68afac1dabe6/setup.cfg
https://github.com/tqdm/tqdm/raw/fc69d5dcf578f7c7986fa76841a6b793f813df35/setup.cfg
https://github.com/platformdirs/platformdirs/raw/7b7852128dd6f07511b618d6edea35046bd0c6ff/setup.cfg
https://github.com/pandas-dev/pandas/raw/bc17343f934a33dc231c8c74be95d8365537c376/setup.cfg
https://github.com/django/django/raw/4e249d11a6e56ca8feb4b055b681cec457ef3a3d/setup.cfg
Expand Down
21 changes: 0 additions & 21 deletions setuptools/tests/config/test_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_apply_pyproject_equivalent_to_setupcfg(url, monkeypatch, tmp_path):

dist_toml = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject_example)
dist_cfg = setupcfg.apply_configuration(makedist(tmp_path), setupcfg_example)
_port_tests_require(dist_cfg)

pkg_info_toml = core_metadata(dist_toml)
pkg_info_cfg = core_metadata(dist_cfg)
Expand Down Expand Up @@ -84,12 +83,6 @@ def test_apply_pyproject_equivalent_to_setupcfg(url, monkeypatch, tmp_path):

assert set(dist_toml.install_requires) == set(dist_cfg.install_requires)
if any(getattr(d, "extras_require", None) for d in (dist_toml, dist_cfg)):
if (
"testing" in dist_toml.extras_require
and "testing" not in dist_cfg.extras_require
):
# ini2toml can automatically convert `tests_require` to `testing` extra
dist_toml.extras_require.pop("testing")
extra_req_toml = {(k, *sorted(v)) for k, v in dist_toml.extras_require.items()}
extra_req_cfg = {(k, *sorted(v)) for k, v in dist_cfg.extras_require.items()}
assert extra_req_toml == extra_req_cfg
Expand Down Expand Up @@ -467,8 +460,6 @@ def core_metadata(dist) -> str:
skip_prefixes += ("Project-URL: Homepage,", "Home-page:")
# May be missing in original (relying on default) but backfilled in the TOML
skip_prefixes += ("Description-Content-Type:",)
# ini2toml can automatically convert `tests_require` to `testing` extra
skip_lines.add("Provides-Extra: testing")
# Remove empty lines
skip_lines.add("")

Expand All @@ -479,15 +470,3 @@ def core_metadata(dist) -> str:
result.append(line + "\n")

return "".join(result)


def _port_tests_require(dist):
"""
``ini2toml`` "forward fix" deprecated tests_require definitions by moving
them into an extra called ``testing``.
"""
tests_require = getattr(dist, "tests_require", None) or []
if tests_require:
dist.tests_require = []
dist.extras_require.setdefault("testing", []).extend(tests_require)
dist._finalize_requires()
6 changes: 0 additions & 6 deletions setuptools/tests/config/test_setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ def test_basic(self, tmpdir):
'scripts = bin/one.py, bin/two.py\n'
'eager_resources = bin/one.py, bin/two.py\n'
'install_requires = docutils>=0.3; pack ==1.1, ==1.3; hey\n'
'tests_require = mock==0.7.2; pytest\n'
'setup_requires = docutils>=0.3; spack ==1.1, ==1.3; there\n'
'dependency_links = http://some.com/here/1, '
'http://some.com/there/2\n'
Expand Down Expand Up @@ -494,7 +493,6 @@ def test_basic(self, tmpdir):
'spack ==1.1, ==1.3',
'there',
])
assert dist.tests_require == ['mock==0.7.2', 'pytest']
assert dist.python_requires == '>=1.0, !=2.8'
assert dist.py_modules == ['module1', 'module2']

Expand All @@ -521,9 +519,6 @@ def test_multiline(self, tmpdir):
' docutils>=0.3\n'
' pack ==1.1, ==1.3\n'
' hey\n'
'tests_require = \n'
' mock==0.7.2\n'
' pytest\n'
'setup_requires = \n'
' docutils>=0.3\n'
' spack ==1.1, ==1.3\n'
Expand Down Expand Up @@ -552,7 +547,6 @@ def test_multiline(self, tmpdir):
'spack ==1.1, ==1.3',
'there',
])
assert dist.tests_require == ['mock==0.7.2', 'pytest']

def test_package_dir_fail(self, tmpdir):
fake_env(tmpdir, '[options]\npackage_dir = a b\n')
Expand Down
1 change: 0 additions & 1 deletion setuptools/tests/test_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
setup_requires=["setuptools"],
install_requires=["quux", "splort"],
extras_require={"simple": ["simple.dist"]},
tests_require=["foo", "bar>=10.0.0"],
entry_points={
"console_scripts": [
"complex-dist=complexdist:main",
Expand Down

0 comments on commit 6404823

Please sign in to comment.