Skip to content

Commit d9a927b

Browse files
committed
test iter_find_files max depth
1 parent ee3c660 commit d9a927b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/test_fileutils.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
from boltons.fileutils import FilePerms
1+
import os.path
2+
3+
from boltons import fileutils
4+
from boltons.fileutils import FilePerms, iter_find_files
5+
6+
7+
BOLTONS_PATH = os.path.dirname(os.path.abspath(fileutils.__file__))
28

39

410
def test_fileperms():
@@ -17,3 +23,14 @@ def test_fileperms():
1723
assert oct(int(up)) == '0o770'
1824

1925
assert int(FilePerms()) == 0
26+
27+
28+
def test_iter_find_files():
29+
def _to_baseless_list(paths):
30+
return [p.lstrip(BOLTONS_PATH) for p in paths]
31+
32+
assert 'fileutils.py' in _to_baseless_list(iter_find_files(BOLTONS_PATH, patterns=['*.py']))
33+
34+
boltons_parent = os.path.dirname(BOLTONS_PATH)
35+
assert 'fileutils.py' in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py']))
36+
assert 'fileutils.py' not in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py'], max_depth=0))

0 commit comments

Comments
 (0)