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
Defend from AttributeErrors in CloudPath.__del__ #418
Defend from AttributeErrors in CloudPath.__del__ #418
Conversation
If the CloudPath Client instance is incomplete, it may not have a file_cache_mode attribute. Using getattr defensively prevents the AttributeError from causing __del__ to exit early.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #418 +/- ##
========================================
- Coverage 93.8% 93.4% -0.4%
========================================
Files 23 23
Lines 1643 1644 +1
========================================
- Hits 1542 1537 -5
- Misses 101 107 +6
|
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 good. Merging this into new branch 418-live-tests
for live tests.
Thank you, and thank you for addressing the nit |
* Defend from AttributeErrors in CloudPath.__del__ If the CloudPath Client instance is incomplete, it may not have a file_cache_mode attribute. Using getattr defensively prevents the AttributeError from causing __del__ to exit early. * Update HISTORY * Fix tests by fixing a copy-paste mistake * Use None instead of object as dummy client. --------- Co-authored-by: Bryan Weber <bryan.w.weber@gmail.com> Co-authored-by: Jay Qi <jayqi@users.noreply.github.com>
If the CloudPath Client instance is incomplete, it may not have a file_cache_mode attribute. Using getattr defensively prevents the AttributeError from causing del to exit early.
Closes #372
Contributor checklist:
CONTRIBUTING.md
Closes #issue
appears in the PR summary (e.g.,Closes #123
).HISTORY.md
with the issue that is addressed and the PR you are submitting. If the top section is not `## UNRELEASED``, then you need to add a new section to the top of the document for your change.