-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: ✨ add path_*()
functions (with their verify_*()
'ers)
#730
Conversation
The utility functions expands on the raised error to include existing ID's.
The utility functions make it easier to create the folder structure of packages and resources for testing the `path_()*` functions.
Since they are now in the init file.
path_*()
functions with utilspath_*()
functions with helper functions
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.
Really nice!! Just some comments 😊
Instead of converting it to a string and then back to Path in the tests
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.
@martonvago and @signekb I refactored the verify function into two, because the original one was confusing to me and had too many arguments for the purpose I interpreted it had. Makes the code a bit cleaner.
sprout/core/verify_is_package_dir.py
Outdated
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 split the original verify function into two rather than one, and simplified them a lot. The original confused me.
path_*()
functions with helper functionspath_*()
functions (with their verify_*()
'ers)
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.
Looks great! Just a tiny comment.
Only other thing I can think of is that FileNotFoundError
s are not being tested, but we can add those tests later too.
A Path to the resources within the package. | ||
""" | ||
path = path_package(package_id) / "resources" | ||
verify_is_package_dir(path.parent) |
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.
Doesn't path_package
already do this (meaning this will never throw)?
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.
@martonvago since the verify_is_file()
already has a unit test for it, I'm not too worried that we don't test that the files exist or not for these tests.
Description
I decided to have a script for path functions related to packages and one related to resources. I found that it became too long - for my taste at least - with the docstrings otherwise.
To add existing ID's to the raised errors, I have added two verify functions.
To test the path functions, I have created some helper functions to create the directory structure of packages and resources.
Closes #714
Reviewer Focus
This PR needs an in-depth review.
Checklist