-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow for roundtrip of cloudpaths through pickle serialization
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
- Loading branch information
Showing
2 changed files
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pickle | ||
|
||
from cloudpathlib import CloudPath | ||
|
||
|
||
def test_pickle_roundtrip(): | ||
path1 = CloudPath("s3://bucket/key") | ||
pkl1 = pickle.dumps(path1) | ||
|
||
path2 = pickle.loads(pkl1) | ||
pkl2 = pickle.dumps(path2) | ||
|
||
assert path1 == path2 | ||
assert pkl1 == pkl2 |