@@ -51,7 +51,7 @@ def test_get_available(self):
5151 print (f"Failed to create hasher for { algorithm } : { exc } " )
5252 assert exc .args [0 ] == f"unsupported hash type { algorithm } "
5353 hasher = None
54-
54+
5555 if hasher is not None :
5656 assert hasattr (hasher , 'update' )
5757 assert hasattr (hasher , 'hexdigest' )
@@ -267,7 +267,7 @@ def test_cyclic_link(self):
267267 with pytest .raises (SymlinkRecursionError ):
268268 filepaths = included_paths (self .path_to ('root' ))
269269
270- def test_ignore_hidden_files (self ):
270+ def test_ignore_hidden (self ):
271271 self .mkdirs ('root/d1' )
272272 self .mkdirs ('root/.d2' )
273273
@@ -282,12 +282,45 @@ def test_ignore_hidden_files(self):
282282 assert filepaths == ['.d2/f1' , '.f2' , 'd1/.f2' , 'd1/f1' , 'f1' ]
283283
284284 # with ignore
285- filepaths = included_paths (
286- self .path_to ('root' ),
287- match = ['*' , '!.*' ]
288- )
285+ filepaths = included_paths (self .path_to ('root' ), match = ['*' , '!.*' ])
286+ assert filepaths == ['d1/f1' , 'f1' ]
287+
288+ def test_ignore_hidden_files_only (self ):
289+ self .mkdirs ('root/d1' )
290+ self .mkdirs ('root/.d2' )
291+
292+ self .mkfile ('root/f1' )
293+ self .mkfile ('root/.f2' )
294+ self .mkfile ('root/d1/f1' )
295+ self .mkfile ('root/d1/.f2' )
296+ self .mkfile ('root/.d2/f1' )
297+
298+ # no ignore
299+ filepaths = included_paths (self .path_to ('root' ))
300+ assert filepaths == ['.d2/f1' , '.f2' , 'd1/.f2' , 'd1/f1' , 'f1' ]
301+
302+ # with ignore
303+ filepaths = included_paths (self .path_to ('root' ), match = ['**/*' , '!**/.*' , '**/.*/*' , '!**/.*/.*' ])
289304 assert filepaths == ['.d2/f1' , 'd1/f1' , 'f1' ]
290305
306+ def test_ignore_hidden_explicitly_recursive (self ):
307+ self .mkdirs ('root/d1' )
308+ self .mkdirs ('root/.d2' )
309+
310+ self .mkfile ('root/f1' )
311+ self .mkfile ('root/.f2' )
312+ self .mkfile ('root/d1/f1' )
313+ self .mkfile ('root/d1/.f2' )
314+ self .mkfile ('root/.d2/f1' )
315+
316+ # no ignore
317+ filepaths = included_paths (self .path_to ('root' ))
318+ assert filepaths == ['.d2/f1' , '.f2' , 'd1/.f2' , 'd1/f1' , 'f1' ]
319+
320+ # with ignore
321+ filepaths = included_paths (self .path_to ('root' ), match = ['*' , '!**/.*' ])
322+ assert filepaths == ['d1/f1' , 'f1' ]
323+
291324 def test_exclude_hidden_dirs (self ):
292325 self .mkdirs ('root/d1' )
293326 self .mkdirs ('root/.d2' )
0 commit comments