Fix tests for setuptools >= 70 which removed tests_require#21
Merged
Fix tests for setuptools >= 70 which removed tests_require#21
Conversation
setuptools >= 70 removed the tests_require attribute from Distribution objects as part of the deprecation of `python setup.py test`. The extraction code already handles this gracefully via hasattr() guards, but the test expectations unconditionally asserted tests_require would be present in the output. Use a runtime feature probe (_HAS_TESTS_REQUIRE) to conditionally include tests_require in expected test data, so tests pass on both old and new setuptools versions. Fixes #20
…ncat Move tests_require to a separate parametrize argument and check it conditionally in the test body. This avoids W504 and E12x lint violations from the list concatenation approach.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests_requireattribute fromDistributionobjects as part of the deprecation ofpython setup.py testmetaextract.pyalready handles this correctly viahasattr()guards — when the attribute is absent, it's simply omitted from the outputtests_requirewould be present in the extracted metadata_HAS_TESTS_REQUIRE) that checks whether the installed setuptools actually has the attribute, and conditionally includes it in test expectationsThis ensures tests pass on both setuptools < 70 (where
tests_requireis present) and >= 70 (where it's removed).Test plan
tests_require)tests_requireis still presentFixes #20