Skip to content

Commit 26e9a71

Browse files
SnoopJabravalheri
authored andcommitted
Add test for tools.setuptools warning
1 parent 8d1809d commit 26e9a71

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

setuptools/tests/config/test_pyprojecttoml.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from path import Path
99

1010
from setuptools.config.pyprojecttoml import (
11+
_ToolsTypoInMetadata,
1112
read_configuration,
1213
expand_configuration,
1314
apply_configuration,
@@ -369,3 +370,28 @@ def test_include_package_data_in_setuppy(tmp_path):
369370
assert dist.get_name() == "myproj"
370371
assert dist.get_version() == "42"
371372
assert dist.include_package_data is False
373+
374+
375+
def test_warn_tools_typo(tmp_path):
376+
"""Test that the common ``tools.setuptools`` typo in ``pyproject.toml`` issues a warning
377+
378+
See https://github.com/pypa/setuptools/issues/4150
379+
"""
380+
config = """
381+
[build-system]
382+
requires = ["setuptools"]
383+
build-backend = "setuptools.build_meta"
384+
385+
[project]
386+
name = "myproj"
387+
version = '42'
388+
389+
[tools.setuptools]
390+
packages = ["package"]
391+
"""
392+
393+
pyproject = tmp_path / "pyproject.toml"
394+
pyproject.write_text(cleandoc(config), encoding="utf-8")
395+
396+
with pytest.warns(_ToolsTypoInMetadata):
397+
expanded = read_configuration(pyproject)

0 commit comments

Comments
 (0)