-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: pluralize function signature and test update #10450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: pluralize function signature and test update #10450
Conversation
Reviewer's GuideRefactors the pluralize helper to use a clear (count, singular) signature with logic to append “s” for non-unit counts and updates tests accordingly to resolve existing failures. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @eslteacher902010 - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not even know that such a function exists. 😅
Can you please use pytest.mark.parametrize instead of calling the function multiple times in the test.
And please take a look at the failing pre-commit.ci. See also https://python-poetry.org/docs/contributing/#local-development
Thanks for the feedback! I removed the obsolete test_shell.py (now that I understand the shell logic lives in a plugin) and added a test file for the helper functions (pluralize, is_dir_writable, and parse_requires). I also updated the tests to use pytest.mark.parametrize where appropriate. Let me know if there’s anything else I should tweak! |
This PR improves test coverage and clarity for three utility functions:
pluralize: Updated signature to take both a count and singular word, defaulting to appending "s" when appropriate.
parse_requires: Added tests to validate parsing of multiline requirement strings.
is_dir_writable: Added cross-platform tests for directory writability, including permission errors and missing directories.
These changes fix test mismatches, improve clarity, and increase overall reliability of Poetry’s helper functions.