Skip to content

Commit c0a5242

Browse files
committed
Fix bug in fileutils tests
1 parent ad14437 commit c0a5242

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/test_fileutils.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from boltons.fileutils import FilePerms, iter_find_files
99

1010

11+
# Directory of boltons source files (not ending with '/').
1112
BOLTONS_PATH = os.path.dirname(os.path.abspath(fileutils.__file__))
1213

1314

@@ -31,13 +32,13 @@ def test_fileperms():
3132

3233
def test_iter_find_files():
3334
def _to_baseless_list(paths):
34-
return [p.lstrip(BOLTONS_PATH) for p in paths]
35+
return [p.removeprefix(BOLTONS_PATH) for p in paths]
3536

36-
assert 'fileutils.py' in _to_baseless_list(iter_find_files(BOLTONS_PATH, patterns=['*.py']))
37+
assert '/fileutils.py' in _to_baseless_list(iter_find_files(BOLTONS_PATH, patterns=['*.py']))
3738

3839
boltons_parent = os.path.dirname(BOLTONS_PATH)
39-
assert 'fileutils.py' in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py']))
40-
assert 'fileutils.py' not in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py'], max_depth=0))
40+
assert '/fileutils.py' in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py']))
41+
assert '/fileutils.py' not in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py'], max_depth=0))
4142

4243

4344
def test_rotate_file_no_rotation(tmp_path):

0 commit comments

Comments
 (0)