Example #1
0
 def test_auto_close(self):
     """Test MultiFS auto close is working"""
     multi_fs = MultiFS()
     m1 = MemoryFS()
     m2 = MemoryFS()
     multi_fs.add_fs("m1", m1)
     multi_fs.add_fs("m2", m2)
     self.assertFalse(m1.isclosed())
     self.assertFalse(m2.isclosed())
     multi_fs.close()
     self.assertTrue(m1.isclosed())
     self.assertTrue(m2.isclosed())
Example #2
0
 def test_no_auto_close(self):
     """Test MountFS auto close can be disabled"""
     mount_fs = MountFS(auto_close=False)
     m1 = MemoryFS()
     m2 = MemoryFS()
     mount_fs.mount("/m1", m1)
     mount_fs.mount("/m2", m2)
     self.assertFalse(m1.isclosed())
     self.assertFalse(m2.isclosed())
     mount_fs.close()
     self.assertFalse(m1.isclosed())
     self.assertFalse(m2.isclosed())
Example #3
0
 def test_auto_close(self):
     """Test MountFS auto close is working"""
     mount_fs = MountFS()
     m1 = MemoryFS()
     m2 = MemoryFS()
     mount_fs.mount("/m1", m1)
     mount_fs.mount("/m2", m2)
     self.assertFalse(m1.isclosed())
     self.assertFalse(m2.isclosed())
     mount_fs.close()
     self.assertTrue(m1.isclosed())
     self.assertTrue(m2.isclosed())
Example #4
0
 def test_no_auto_close(self):
     """Test MultiFS auto close can be disabled"""
     multi_fs = MultiFS(auto_close=False)
     self.assertEqual(repr(multi_fs), "MultiFS(auto_close=False)")
     m1 = MemoryFS()
     m2 = MemoryFS()
     multi_fs.add_fs("m1", m1)
     multi_fs.add_fs("m2", m2)
     self.assertFalse(m1.isclosed())
     self.assertFalse(m2.isclosed())
     multi_fs.close()
     self.assertFalse(m1.isclosed())
     self.assertFalse(m2.isclosed())
Example #5
0
 def test_manage_fs_obj(self):
     mem_fs = MemoryFS()
     with opener.manage_fs(mem_fs) as open_mem_fs:
         self.assertIs(mem_fs, open_mem_fs)
     self.assertFalse(mem_fs.isclosed())