aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_libmount.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_libmount.py')
-rw-r--r--tests/test_libmount.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_libmount.py b/tests/test_libmount.py
index b9a5c15..8e56970 100644
--- a/tests/test_libmount.py
+++ b/tests/test_libmount.py
@@ -22,7 +22,8 @@ class LibMountTests(TestCase):
libmount.mount(source="", target=path, fs="tmpfs")
yield path
finally:
- libmount.unmount(target=path)
+ with suppress(OSError):
+ libmount.unmount(path)
def test_mount(self):
"""Test normal mounting."""
@@ -62,6 +63,23 @@ class LibMountTests(TestCase):
finally:
libmount.unmount(target=path)
+ def test_unmount_flags(self):
+ """Test unmount flags."""
+ flags = [
+ libmount.UnmountFlags.MNT_FORCE,
+ libmount.UnmountFlags.MNT_DETACH,
+ libmount.UnmountFlags.UMOUNT_NOFOLLOW,
+ ]
+ for flag in flags:
+ with self.subTest(flag=flag), self.get_mount() as path:
+ libmount.unmount(path, flag)
+
+ def test_unmount_flags_expire(self):
+ """Test unmount MNT_EXPIRE behavior."""
+ with self.get_mount() as path:
+ with self.assertRaises(BlockingIOError):
+ libmount.unmount(path, libmount.UnmountFlags.MNT_EXPIRE)
+
def test_unmount_errors(self):
"""Test invalid unmount errors."""
cases = [