allow for roundtrips of cloudpaths through pickle serialization#454
Conversation
| from cloudpathlib import CloudPath | ||
|
|
||
|
|
||
| def test_pickle_roundtrip(): |
There was a problem hiding this comment.
If there is an existing file this would be better suited to put it within let me know and happy to move it!
I verified that this does repro the issue without the above change.
There was a problem hiding this comment.
Separate file for serializing is fine. Can you also move this test over to the new file so they are together?
cloudpathlib/tests/test_cloudpath_file_io.py
Lines 457 to 472 in 08b018b
This avoids an exception thrown because the _client is not serialized into the pickled object, and thus when __getstate__ is called the second time, there is no _client field to delete. Closes drivendataorg#450
47490cf to
514d447
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 454-local #454 +/- ##
===========================================
- Coverage 93.7% 93.4% -0.4%
===========================================
Files 23 23
Lines 1654 1655 +1
===========================================
- Hits 1551 1546 -5
- Misses 103 109 +6
|
| from cloudpathlib import CloudPath | ||
|
|
||
|
|
||
| def test_pickle_roundtrip(): |
There was a problem hiding this comment.
Separate file for serializing is fine. Can you also move this test over to the new file so they are together?
cloudpathlib/tests/test_cloudpath_file_io.py
Lines 457 to 472 in 08b018b
|
Looks good, thanks! One small ask to move the other pickle test to the same place |
|
@kujenga Planning a release soon—will you have a chance to wrap this PR? |
* allow for roundtrips of cloudpaths through pickle serialization (#454) This avoids an exception thrown because the _client is not serialized into the pickled object, and thus when __getstate__ is called the second time, there is no _client field to delete. Closes #450 * pickle tests --------- Co-authored-by: Aaron Taylor <git@ataylor.io>
|
Thank you very much! Apologies I missed the earlier notification |
This avoids an exception thrown because the client is not serialized into the pickeld object, and thus when getstate is called the second time, there is no _client field to delete.
Closes #450
Contributor checklist:
CONTRIBUTING.mdCloses #issueappears in the PR summary (e.g.,Closes #123).HISTORY.mdwith 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.