@@ -74,14 +74,17 @@ def test_local_download_paths(tmp_path: Path):
74
74
assert paths .incomplete_path ("etag123" ).parent .is_dir ()
75
75
76
76
77
- def test_local_download_paths_are_cached (tmp_path : Path ):
78
- """Test local download paths are cached."""
79
- # No need for an exact singleton here.
80
- # We just want to avoid recreating the dataclass on consecutive calls (happens often
81
- # in the process).
77
+ def test_local_download_paths_are_recreated_each_time (tmp_path : Path ):
82
78
paths1 = get_local_download_paths (tmp_path , "path/in/repo.txt" )
79
+ assert paths1 .file_path .parent .is_dir ()
80
+ assert paths1 .metadata_path .parent .is_dir ()
81
+
82
+ paths1 .file_path .parent .rmdir ()
83
+ paths1 .metadata_path .parent .rmdir ()
84
+
83
85
paths2 = get_local_download_paths (tmp_path , "path/in/repo.txt" )
84
- assert paths1 is paths2
86
+ assert paths2 .file_path .parent .is_dir ()
87
+ assert paths2 .metadata_path .parent .is_dir ()
85
88
86
89
87
90
@pytest .mark .skipif (os .name != "nt" , reason = "Windows-specific test." )
@@ -198,14 +201,17 @@ def test_local_upload_paths(tmp_path: Path):
198
201
assert paths .lock_path .parent .is_dir ()
199
202
200
203
201
- def test_local_upload_paths_are_cached (tmp_path : Path ):
202
- """Test local upload paths are cached."""
203
- # No need for an exact singleton here.
204
- # We just want to avoid recreating the dataclass on consecutive calls (happens often
205
- # in the process).
206
- paths1 = get_local_download_paths (tmp_path , "path/in/repo.txt" )
207
- paths2 = get_local_download_paths (tmp_path , "path/in/repo.txt" )
208
- assert paths1 is paths2
204
+ def test_local_upload_paths_are_recreated_each_time (tmp_path : Path ):
205
+ paths1 = get_local_upload_paths (tmp_path , "path/in/repo.txt" )
206
+ assert paths1 .file_path .parent .is_dir ()
207
+ assert paths1 .metadata_path .parent .is_dir ()
208
+
209
+ paths1 .file_path .parent .rmdir ()
210
+ paths1 .metadata_path .parent .rmdir ()
211
+
212
+ paths2 = get_local_upload_paths (tmp_path , "path/in/repo.txt" )
213
+ assert paths2 .file_path .parent .is_dir ()
214
+ assert paths2 .metadata_path .parent .is_dir ()
209
215
210
216
211
217
@pytest .mark .skipif (os .name != "nt" , reason = "Windows-specific test." )
0 commit comments