-
Notifications
You must be signed in to change notification settings - Fork 26
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
Loading of Global and User Configs #113
Conversation
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
1. ConfigFile will generate exceptions all the time, it will not try to handle them because we want all the errors to be handled by the calling function. 2. ProfileManager handles all the exceptions because it is meant to provide smooth user experience. Hence the load function wraps each call to the ConfigFile in a try-catch block. Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
@@ -0,0 +1,56 @@ | |||
{ |
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.
Please add some line and block comments in either this file or the zowe.config.json
fixture. The contents of the comments don't matter, they'll just help to verify that ProfileManager is able to load JSON with comments.
profile_name=profile_name, profile_type=profile_type | ||
) | ||
except Exception as exc: | ||
warnings.warn(f"Could not load Project Config {self.project_config.name}") |
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.
Thanks for replacing errors with warnings where the exception isn't fatal and it makes sense to try continuing 👍
For debugging purposes it would be useful to include the exception message in the warning. Could you update this and all the "Could not load X Config" warnings below to include the exception? Something like this:
warnings.warn(f"Could not load Project Config {self.project_config.name}:\n{exc}")
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
exceptions into warnings fixed tests Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Codecov ReportBase: 64.11% // Head: 66.96% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## next #113 +/- ##
==========================================
+ Coverage 64.11% 66.96% +2.85%
==========================================
Files 28 31 +3
Lines 1006 1111 +105
==========================================
+ Hits 645 744 +99
- Misses 361 367 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Closing in favor of #131 |
Now the Profile Manager class has been split into two parts :
Config File is recommended when the user wants to load just one file while ProfileManager automates the merging of profiles.
TODO : Modify tests that checks if correct exceptions are being loaded.