10
10
11
11
from setuptools .config .setupcfg import ConfigHandler , Target , read_configuration
12
12
from setuptools .dist import Distribution , _Distribution
13
- from setuptools .errors import InvalidConfigError
14
13
from setuptools .warnings import SetuptoolsDeprecationWarning
15
14
16
15
from ..textwrap import DALS
@@ -423,7 +422,7 @@ def test_not_utf8(self, tmpdir):
423
422
pass
424
423
425
424
@pytest .mark .parametrize (
426
- ("error_msg" , "config" ),
425
+ ("error_msg" , "config" , "invalid" ),
427
426
[
428
427
(
429
428
"Invalid dash-separated key 'author-email' in 'metadata' (setup.cfg)" ,
@@ -434,6 +433,7 @@ def test_not_utf8(self, tmpdir):
434
433
maintainer_email = [email protected]
435
434
"""
436
435
),
436
+ {"author-email" : "[email protected] " },
437
437
),
438
438
(
439
439
"Invalid uppercase key 'Name' in 'metadata' (setup.cfg)" ,
@@ -444,14 +444,23 @@ def test_not_utf8(self, tmpdir):
444
444
description = Some description
445
445
"""
446
446
),
447
+ {"Name" : "foo" },
447
448
),
448
449
],
449
450
)
450
- def test_invalid_options_previously_deprecated (self , tmpdir , error_msg , config ):
451
- # this test and related methods can be removed when no longer needed
451
+ def test_invalid_options_previously_deprecated (
452
+ self , tmpdir , error_msg , config , invalid
453
+ ):
454
+ # This test and related methods can be removed when no longer needed.
455
+ # Deprecation postponed due to push-back from the community in
456
+ # https://github.com/pypa/setuptools/issues/4910
452
457
fake_env (tmpdir , config )
453
- with pytest .raises (InvalidConfigError , match = re .escape (error_msg )):
454
- get_dist (tmpdir ).__enter__ ()
458
+ with pytest .warns (SetuptoolsDeprecationWarning , match = re .escape (error_msg )):
459
+ dist = get_dist (tmpdir ).__enter__ ()
460
+
461
+ for field , value in invalid .items ():
462
+ attr = field .replace ("-" , "_" ).lower ()
463
+ assert getattr (dist .metadata , attr ) == value
455
464
456
465
457
466
class TestOptions :
0 commit comments