From fa48ac3626c21efc5261b4f112270ca40d2e004d Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Fri, 5 Mar 2021 23:20:59 -0500 Subject: [PATCH] Test for uppercase metadata warning --- setuptools/tests/test_config.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index eac26749d4..454ffb245e 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -526,6 +526,24 @@ def test_dash_to_underscore_warning(self, tmpdir): assert metadata.author_email == 'test@test.com' assert metadata.maintainer_email == 'foo@foo.com' + def test_uppercase_warning(self, tmpdir): + # remove this test and the method uppercase_warning() in setuptools.dist + # when no longer needed + fake_env( + tmpdir, + '[metadata]\n' + 'Name = foo\n' + 'description = Some description\n' + ) + msg = ("Usage of uppercase key 'Name' in 'metadata' will be deprecated in " + "future versions. " + "Please use lowercase 'name' instead") + with pytest.warns(UserWarning, match=msg): + with get_dist(tmpdir) as dist: + metadata = dist.metadata + assert metadata.name == 'foo' + assert metadata.description == 'Some description' + class TestOptions: