@@ -1757,19 +1757,19 @@ def test_move_dir_same_fs(self):
17571757
17581758 def _test_move_dir_write (self , protocol ):
17591759 # Test moving to this filesystem from another.
1760- other_fs = open_fs (protocol )
1761- other_fs .makedirs ("foo/bar/baz" )
1762- other_fs .makedir ("egg" )
1763- other_fs .writetext ("top.txt" , "Hello, World" )
1764- other_fs .writetext ("/foo/bar/baz/test.txt" , "Goodbye, World" )
1765-
1766- fs .move .move_dir (other_fs , "/" , self .fs , "/" )
1767-
1768- expected = {"/egg" , "/foo" , "/foo/bar" , "/foo/bar/baz" }
1769- self .assertEqual (other_fs .listdir ("/" ), [])
1770- self .assertEqual (set (walk .walk_dirs (self .fs )), expected )
1771- self .assert_text ("top.txt" , "Hello, World" )
1772- self .assert_text ("/foo/bar/baz/test.txt" , "Goodbye, World" )
1760+ with open_fs (protocol ) as other_fs :
1761+ other_fs .makedirs ("foo/bar/baz" )
1762+ other_fs .makedir ("egg" )
1763+ other_fs .writetext ("top.txt" , "Hello, World" )
1764+ other_fs .writetext ("/foo/bar/baz/test.txt" , "Goodbye, World" )
1765+
1766+ fs .move .move_dir (other_fs , "/" , self .fs , "/" )
1767+
1768+ expected = {"/egg" , "/foo" , "/foo/bar" , "/foo/bar/baz" }
1769+ self .assertEqual (other_fs .listdir ("/" ), [])
1770+ self .assertEqual (set (walk .walk_dirs (self .fs )), expected )
1771+ self .assert_text ("top.txt" , "Hello, World" )
1772+ self .assert_text ("/foo/bar/baz/test.txt" , "Goodbye, World" )
17731773
17741774 def test_move_dir_mem (self ):
17751775 self ._test_move_dir_write ("mem://" )
0 commit comments