Skip to content

Commit 5c60234

Browse files
committed
added checks and cleanups to test destructors
1 parent 90c4438 commit 5c60234

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/lib/base.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,15 @@ def init_d_childfs(self):
139139

140140
def destroy_a_childfs(self):
141141

142-
if self.fs_type == TEST_FS_LOGGEDFS:
143-
umount_child_status = umount_fuse(self.mount_child_abs_path, sudo = self.with_sudo)
144-
assert umount_child_status
145-
assert not is_path_mountpoint(self.mount_child_abs_path)
142+
if not self.fs_type == TEST_FS_LOGGEDFS:
143+
return
144+
145+
if not is_path_mountpoint(self.mount_child_abs_path):
146+
return
147+
148+
umount_child_status = umount_fuse(self.mount_child_abs_path, sudo = self.with_sudo)
149+
assert umount_child_status
150+
assert not is_path_mountpoint(self.mount_child_abs_path)
146151

147152
time.sleep(0.1) # HACK ... otherwise parent will be busy
148153

@@ -152,6 +157,8 @@ def destroy_b_parentfs(self):
152157
if self.travis:
153158
return
154159

160+
# TODO mountpoint checks ...
161+
155162
umount_parent_status = umount(self.mount_parent_abs_path, sudo = True)
156163
assert umount_parent_status
157164
assert not is_path_mountpoint(self.mount_parent_abs_path)
@@ -179,6 +186,9 @@ def destroy_b_parentfs(self):
179186

180187
assert not bool(ck_status_code) # not 0 for just about any type of error! Therefore asserting at the very end.
181188

189+
os.remove(self.image_abs_path)
190+
assert not os.path.exists(self.image_abs_path)
191+
182192

183193
def __attach_loop_device__(self):
184194

0 commit comments

Comments
 (0)