@@ -94,19 +94,24 @@ class _FakeAccessor(accessor):
94
94
95
95
listdir = _wrap_strfunc (FakeFilesystem .listdir )
96
96
97
- chmod = _wrap_strfunc (FakeFilesystem .chmod )
98
-
99
97
if use_scandir :
100
98
scandir = _wrap_strfunc (fake_scandir .scandir )
101
99
102
100
if hasattr (os , "lchmod" ):
103
101
lchmod = _wrap_strfunc (lambda fs , path , mode : FakeFilesystem .chmod (
104
102
fs , path , mode , follow_symlinks = False ))
103
+ chmod = _wrap_strfunc (FakeFilesystem .chmod )
105
104
else :
106
- def lchmod (self , pathobj , mode ):
105
+ def lchmod (self , pathobj , * args , ** kwargs ):
107
106
"""Raises not implemented for Windows systems."""
108
107
raise NotImplementedError ("lchmod() not available on this system" )
109
108
109
+ def chmod (self , pathobj , * args , ** kwargs ):
110
+ if "follow_symlinks" in kwargs and not kwargs ["follow_symlinks" ]:
111
+ raise NotImplementedError (
112
+ "lchmod() not available on this system" )
113
+ return pathobj .filesystem .chmod (str (pathobj ), * args , ** kwargs )
114
+
110
115
mkdir = _wrap_strfunc (FakeFilesystem .makedir )
111
116
112
117
unlink = _wrap_strfunc (FakeFilesystem .remove )
@@ -135,7 +140,8 @@ def lchmod(self, pathobj, mode):
135
140
FakeFilesystem .link (fs , file_path , link_target ))
136
141
137
142
# this will use the fake filesystem because os is patched
138
- getcwd = lambda p : os .getcwd ()
143
+ def getcwd (self ):
144
+ return os .getcwd ()
139
145
140
146
readlink = _wrap_strfunc (FakeFilesystem .readlink )
141
147
0 commit comments