@@ -117,6 +117,58 @@ def test_rmdirs(self):
117
117
assert self .operations .rmdirs (path ,ignore_errors = False )is True
118
118
assert not os .path .exists (path )
119
119
120
+ def test_rmdirs__01_with_subfolder (self ):
121
+ # folder with subfolder
122
+ path = self .operations .mkdtemp ()
123
+ assert os .path .exists (path )
124
+
125
+ dir1 = os .path .join (path ,"dir1" )
126
+ assert not os .path .exists (dir1 )
127
+
128
+ self .operations .makedirs (dir1 )
129
+ assert os .path .exists (dir1 )
130
+
131
+ assert self .operations .rmdirs (path ,ignore_errors = False )is True
132
+ assert not os .path .exists (path )
133
+ assert not os .path .exists (dir1 )
134
+
135
+ def test_rmdirs__02_with_file (self ):
136
+ # folder with file
137
+ path = self .operations .mkdtemp ()
138
+ assert os .path .exists (path )
139
+
140
+ file1 = os .path .join (path ,"file1.txt" )
141
+ assert not os .path .exists (file1 )
142
+
143
+ self .operations .touch (file1 )
144
+ assert os .path .exists (file1 )
145
+
146
+ assert self .operations .rmdirs (path ,ignore_errors = False )is True
147
+ assert not os .path .exists (path )
148
+ assert not os .path .exists (file1 )
149
+
150
+ def test_rmdirs__03_with_subfolder_and_file (self ):
151
+ # folder with subfolder and file
152
+ path = self .operations .mkdtemp ()
153
+ assert os .path .exists (path )
154
+
155
+ dir1 = os .path .join (path ,"dir1" )
156
+ assert not os .path .exists (dir1 )
157
+
158
+ self .operations .makedirs (dir1 )
159
+ assert os .path .exists (dir1 )
160
+
161
+ file1 = os .path .join (dir1 ,"file1.txt" )
162
+ assert not os .path .exists (file1 )
163
+
164
+ self .operations .touch (file1 )
165
+ assert os .path .exists (file1 )
166
+
167
+ assert self .operations .rmdirs (path ,ignore_errors = False )is True
168
+ assert not os .path .exists (path )
169
+ assert not os .path .exists (dir1 )
170
+ assert not os .path .exists (file1 )
171
+
120
172
def test_rmdirs__try_to_delete_nonexist_path (self ):
121
173
path = "/root/test_dir"
122
174