@@ -37,12 +37,10 @@ def test_copy_fs(self, workers):
3737 dst_file1_info = dst_fs .getinfo ("test.txt" , namespaces )
3838 dst_file2_info = dst_fs .getinfo ("foo/bar/baz.txt" , namespaces )
3939 self .assertEqual (dst_file1_info .modified , src_file1_info .modified )
40- self .assertEqual (dst_file1_info .accessed , src_file1_info .accessed )
4140 self .assertEqual (
4241 dst_file1_info .metadata_changed , src_file1_info .metadata_changed
4342 )
4443 self .assertEqual (dst_file2_info .modified , src_file2_info .modified )
45- self .assertEqual (dst_file2_info .accessed , src_file2_info .accessed )
4644 self .assertEqual (
4745 dst_file2_info .metadata_changed , src_file2_info .metadata_changed
4846 )
@@ -53,6 +51,28 @@ def test_copy_value_error(self):
5351 with self .assertRaises (ValueError ):
5452 fs .copy .copy_fs (src_fs , dst_fs , workers = - 1 )
5553
54+ def test_copy_dir0 (self ):
55+ namespaces = ("details" , "accessed" , "metadata_changed" , "modified" )
56+
57+ src_fs = open_fs ("mem://" )
58+ src_fs .makedirs ("foo/bar" )
59+ src_fs .makedirs ("foo/empty" )
60+ src_fs .touch ("test.txt" )
61+ src_fs .touch ("foo/bar/baz.txt" )
62+ src_file2_info = src_fs .getinfo ("foo/bar/baz.txt" , namespaces )
63+
64+ with open_fs ("mem://" ) as dst_fs :
65+ fs .copy .copy_dir (src_fs , "/foo" , dst_fs , "/" , workers = 0 , preserve_time = True )
66+ self .assertTrue (dst_fs .isdir ("bar" ))
67+ self .assertTrue (dst_fs .isdir ("empty" ))
68+ self .assertTrue (dst_fs .isfile ("bar/baz.txt" ))
69+
70+ dst_file2_info = dst_fs .getinfo ("bar/baz.txt" , namespaces )
71+ self .assertEqual (dst_file2_info .modified , src_file2_info .modified )
72+ self .assertEqual (
73+ dst_file2_info .metadata_changed , src_file2_info .metadata_changed
74+ )
75+
5676 @parameterized .expand ([(0 ,), (1 ,), (2 ,), (4 ,)])
5777 def test_copy_dir (self , workers ):
5878 namespaces = ("details" , "accessed" , "metadata_changed" , "modified" )
@@ -62,7 +82,6 @@ def test_copy_dir(self, workers):
6282 src_fs .makedirs ("foo/empty" )
6383 src_fs .touch ("test.txt" )
6484 src_fs .touch ("foo/bar/baz.txt" )
65- src_file1_info = src_fs .getinfo ("test.txt" , namespaces )
6685 src_file2_info = src_fs .getinfo ("foo/bar/baz.txt" , namespaces )
6786
6887 with open_fs ("mem://" ) as dst_fs :
@@ -75,7 +94,6 @@ def test_copy_dir(self, workers):
7594
7695 dst_file2_info = dst_fs .getinfo ("bar/baz.txt" , namespaces )
7796 self .assertEqual (dst_file2_info .modified , src_file2_info .modified )
78- self .assertEqual (dst_file2_info .accessed , src_file2_info .accessed )
7997 self .assertEqual (
8098 dst_file2_info .metadata_changed , src_file2_info .metadata_changed
8199 )
0 commit comments