File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ def move_file(
5959 resources (defaults to `False`).
6060
6161 """
62- with manage_fs (src_fs ) as _src_fs :
63- with manage_fs (dst_fs , create = True ) as _dst_fs :
62+ with manage_fs (src_fs , writeable = True ) as _src_fs :
63+ with manage_fs (dst_fs , writeable = True , create = True ) as _dst_fs :
6464 if _src_fs is _dst_fs :
6565 # Same filesystem, may be optimized
6666 _src_fs .move (
@@ -90,6 +90,8 @@ def move_file(
9090 base .move (rel_src , rel_dst , preserve_time = preserve_time )
9191 return # optimization worked, exit early
9292 except ValueError :
93+ # This is raised if we cannot find a common base folder.
94+ # In this case just fall through to the standard method.
9395 pass
9496
9597 # Standard copy and delete
Original file line number Diff line number Diff line change @@ -89,7 +89,9 @@ def test_move_file_read_only_source(self):
8989 dst = tmp .makedir ("sub" )
9090 with self .assertRaises (ResourceReadOnly ):
9191 fs .move .move_file (src , "file.txt" , dst , "file.txt" )
92- self .assertFalse (dst .exists ("file.txt" ))
92+ self .assertFalse (
93+ dst .exists ("file.txt" ), "file should not have been copied over"
94+ )
9395 self .assertTrue (src .exists ("file.txt" ))
9496
9597 def test_move_file_read_only_mem_source (self ):
@@ -99,7 +101,9 @@ def test_move_file_read_only_mem_source(self):
99101 src_ro = read_only (src )
100102 with self .assertRaises (ResourceReadOnly ):
101103 fs .move .move_file (src_ro , "file.txt" , sub , "file.txt" )
102- self .assertFalse (sub .exists ("file.txt" ))
104+ self .assertFalse (
105+ sub .exists ("file.txt" ), "file should not have been copied over"
106+ )
103107 self .assertTrue (src .exists ("file.txt" ))
104108
105109 def test_move_dir (self ):
You can’t perform that action at this time.
0 commit comments