Skip to content

Commit dc9e6a3

Browse files
Fixed regression for isDir() with trailing separator under MacOS
- fixes #387
1 parent e9d1061 commit dc9e6a3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pyfakefs/fake_filesystem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2657,7 +2657,7 @@ def _is_of_type(self, path, st_flag, follow_symlinks=True):
26572657
obj = self.resolve(path, follow_symlinks)
26582658
if obj:
26592659
self.raise_for_filepath_ending_with_separator(
2660-
path, obj, macos_handling=True)
2660+
path, obj, macos_handling=not follow_symlinks)
26612661
return S_IFMT(obj.st_mode) == st_flag
26622662
except (IOError, OSError):
26632663
return False

pyfakefs/tests/fake_os_test.py

+4
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,10 @@ def test_append_mode_tell_macos(self):
12121212
self.check_macos_only()
12131213
self.check_append_mode_tell_after_truncate(7)
12141214

1215+
def test_dir_with_trailing_sep_is_dir(self):
1216+
# regression test for #387
1217+
self.assertTrue(self, self.os.path.isdir(self.base_path + self.os.sep))
1218+
12151219
def test_rename_dir(self):
12161220
"""Test a rename of a directory."""
12171221
directory = self.make_path('xyzzy')

0 commit comments

Comments
 (0)