14
14
from setuptools .dist import Distribution
15
15
from setuptools .config import setupcfg , pyprojecttoml
16
16
from setuptools .config import expand
17
- from setuptools .config ._apply_pyprojecttoml import _WouldIgnoreField
17
+ from setuptools .config ._apply_pyprojecttoml import _WouldIgnoreField , _some_attrgetter
18
18
from setuptools .command .egg_info import write_requirements
19
19
20
20
@@ -234,12 +234,14 @@ def test_not_listed_in_dynamic(self, tmp_path, attr, field, value):
234
234
dist = pyprojecttoml .apply_configuration (dist , pyproject )
235
235
236
236
# TODO: Once support for pyproject.toml config stabilizes attr should be None
237
- dist_value = getattr ( dist , attr , None ) or getattr (dist . metadata , attr , object () )
237
+ dist_value = _some_attrgetter ( f"metadata. { attr } " , attr ) (dist )
238
238
assert dist_value == value
239
239
240
240
@pytest .mark .parametrize (
241
241
"attr, field, value" ,
242
242
[
243
+ ("install_requires" , "dependencies" , []),
244
+ ("extras_require" , "optional-dependencies" , {}),
243
245
("install_requires" , "dependencies" , ["six" ]),
244
246
("classifiers" , "classifiers" , ["Private :: Classifier" ]),
245
247
]
@@ -248,7 +250,7 @@ def test_listed_in_dynamic(self, tmp_path, attr, field, value):
248
250
pyproject = self .pyproject (tmp_path , [field ])
249
251
dist = makedist (tmp_path , ** {attr : value })
250
252
dist = pyprojecttoml .apply_configuration (dist , pyproject )
251
- dist_value = getattr ( dist , attr , None ) or getattr (dist . metadata , attr , object () )
253
+ dist_value = _some_attrgetter ( f"metadata. { attr } " , attr ) (dist )
252
254
assert dist_value == value
253
255
254
256
def test_optional_dependencies_dont_remove_env_markers (self , tmp_path ):
0 commit comments