5 from integration_test import IntegrationTest
7 class UnmountTest(IntegrationTest):
9 super(UnmountTest, self).setUp()
14 for d in self.to_delete:
16 super(UnmountTest, self).tearDown()
18 def test_replace(self):
19 subprocess.check_call(
20 ['arv-mount', '--subtype', 'test', '--replace',
22 subprocess.check_call(
23 ['arv-mount', '--subtype', 'test', '--replace',
24 '--unmount-timeout', '10',
26 subprocess.check_call(
27 ['arv-mount', '--subtype', 'test', '--replace',
28 '--unmount-timeout', '10',
31 for m in subprocess.check_output(['mount']).splitlines():
32 self.assertNotIn(' '+self.mnt+' ', m)
34 def _mounted(self, mounts):
35 all_mounts = subprocess.check_output(['mount', '-t', 'fuse.test'])
36 return [m for m in mounts
37 if ' '+m+' ' in all_mounts]
39 def test_unmount_children(self):
40 for d in ['foo', 'foo/bar', 'bar']:
43 self.to_delete.insert(0, mnt)
45 for d in ['bar', 'foo/bar']:
48 subprocess.check_call(
49 ['arv-mount', '--subtype', 'test', mnt])
51 # Wait for mounts to attach
52 deadline = time.time() + 10
53 while self._mounted(mounts) != mounts:
55 self.assertLess(time.time(), deadline)
57 self.assertEqual(mounts, self._mounted(mounts))
58 subprocess.check_call(['arv-mount', '--unmount', self.tmp])
59 self.assertEqual(mounts, self._mounted(mounts))
60 subprocess.check_call(['arv-mount', '--unmount-all', self.tmp])
61 self.assertEqual([], self._mounted(mounts))