'When used as a context manager, the filesystem is unmounted even if
exceptions are raised.'

def test_context_manager_error(self):

    class SomeException(Exception, ):
        pass
    filename = random_name(self)
    filecontent = random_name(self)
    mount_directory = self.make_temporary_directory()
    try:
        with mount(self.device.device, mount_directory) as mountpoint:
            with mountpoint.child(filename).open('w') as f:
                f.write(filecontent)
            self.assertEqual(filecontent, mount_directory.child(filename).getContent())
            raise SomeException()
    except SomeException:
        self.assertEqual([], mount_directory.children())
    else:
        self.fail('The    expected    ``SomeException``    was    not    raised.')
