File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 11## Version 0.4.1 (in development)
22
3+ ### Fixes
4+
5+ * If the target _ parent_ directory did not exist, an exception was raised
6+ reporting that the lock file to be written does not exist. Changed this to
7+ report that the target parent directory does not exist. [ #55 ]
8+
39## Version 0.4.0 (from 2024-02-08)
410
511### Enhancements
Original file line number Diff line number Diff line change @@ -55,6 +55,21 @@ def test_some_slices_local(self):
5555 for slice_dir in slices :
5656 shutil .rmtree (slice_dir , ignore_errors = True )
5757
58+ def test_some_slices_local_output_to_non_existing_dir (self ):
59+ target_dir = "non_existent_dir/target.zarr"
60+ slices = [
61+ "slice-1.zarr" ,
62+ "slice-2.zarr" ,
63+ "slice-3.zarr" ,
64+ ]
65+ for uri in slices :
66+ make_test_dataset (uri = uri )
67+ with pytest .raises (
68+ FileNotFoundError ,
69+ match = "\\ ATarget parent directory does not exist: .*/non_existent_dir\\ Z" ,
70+ ):
71+ zappend (slices , target_dir = target_dir )
72+
5873 def test_some_slices_with_class_slice_source (self ):
5974 target_dir = "memory://target.zarr"
6075 slices = [make_test_dataset (), make_test_dataset (), make_test_dataset ()]
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ def __enter__(self):
115115 )
116116 self ._entered_ctx = True
117117
118+ if not self .target_dir .parent .exists ():
119+ raise FileNotFoundError (
120+ f"Target parent directory does not exist:"
121+ f" { self .target_dir .parent .path } "
122+ )
123+
118124 lock_file = self ._lock_file
119125 if lock_file .exists ():
120126 raise OSError (f"Target is locked: { lock_file .uri } " )
You can’t perform that action at this time.
0 commit comments