@@ -156,6 +156,36 @@ def test_mkdir_exists_ok_false(self):
156156 with pytest .raises (FileExistsError ):
157157 new_dir .mkdir (exist_ok = False )
158158
159+ def test_mkdir_parents_true_exists_ok_true (self ):
160+ new_dir = self .path .joinpath ("parent" , "new_dir_may_not_exist" )
161+ new_dir .mkdir (parents = True )
162+ if not self .SUPPORTS_EMPTY_DIRS :
163+ new_dir .joinpath (".file" ).touch ()
164+ new_dir .mkdir (parents = True , exist_ok = True )
165+
166+ def test_mkdir_parents_true_exists_ok_false (self ):
167+ new_dir = self .path .joinpath ("parent" , "new_dir_may_exist" )
168+ new_dir .mkdir (parents = True )
169+ if not self .SUPPORTS_EMPTY_DIRS :
170+ new_dir .joinpath (".file" ).touch ()
171+ with pytest .raises (FileExistsError ):
172+ new_dir .mkdir (parents = True , exist_ok = False )
173+
174+ def test_makedirs_exist_ok_true (self ):
175+ new_dir = self .path .joinpath ("parent" , "child" , "dir_may_not_exist" )
176+ new_dir ._accessor .makedirs (new_dir , exist_ok = True )
177+ if not self .SUPPORTS_EMPTY_DIRS :
178+ new_dir .joinpath (".file" ).touch ()
179+ new_dir ._accessor .makedirs (new_dir , exist_ok = True )
180+
181+ def test_makedirs_exist_ok_false (self ):
182+ new_dir = self .path .joinpath ("parent" , "child" , "dir_may_exist" )
183+ new_dir ._accessor .makedirs (new_dir , exist_ok = False )
184+ if not self .SUPPORTS_EMPTY_DIRS :
185+ new_dir .joinpath (".file" ).touch ()
186+ with pytest .raises (FileExistsError ):
187+ new_dir ._accessor .makedirs (new_dir , exist_ok = False )
188+
159189 def test_open (self ):
160190 pass
161191
0 commit comments