Skip to content

Commit

Permalink
Try using alpharep. Doesn't work because the zipfile can't be pickled.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 8, 2022
1 parent 6f700a4 commit f176726
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions test_zipp.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,22 +418,13 @@ def test_inheritance(self, alpharep):
file = cls(alpharep).joinpath('some dir').parent
assert isinstance(file, cls)

def test_can_pickle_string_path(self):
path_1 = zipp.Path("/path/to/a/file.zip")
path_1_pickle = pickle.dumps(path_1)
path_1_load = pickle.loads(path_1_pickle)
assert path_1.root == path_1_load.root
path_2 = zipp.Path("/path/to/a/file.zip", at="something.txt")
path_2_pickle = pickle.dumps(path_2)
path_2_load = pickle.loads(path_2_pickle)
assert path_2.root == path_2_load.root

def test_can_pickle_pathlib_path(self):
path_1 = zipp.Path(pathlib.Path("/path/to/a/file.zip"))
@pass_alpharep
def test_can_pickle(self, alpharep):
path_1 = zipp.Path(alpharep)
path_1_pickle = pickle.dumps(path_1)
path_1_load = pickle.loads(path_1_pickle)
assert path_1.root == path_1_load.root
path_2 = zipp.Path(pathlib.Path("/path/to/a/file.zip", at="something.txt"))
path_2 = zipp.Path(alpharep, at="something.txt")
path_2_pickle = pickle.dumps(path_2)
path_2_load = pickle.loads(path_2_pickle)
assert path_2.root == path_2_load.root

0 comments on commit f176726

Please sign in to comment.