'Test that file handles expire from cache.'

def testOpenFilehandlesExpire(self):

    files.FILE_HANDLE_CACHE = utils.FastStore(max_size=10)
    current_process = psutil.Process(os.getpid())
    num_open_files = len(current_process.open_files())
    path = os.path.join(self.base_path, 'morenumbers.txt')
    fd = vfs.VFSOpen(rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS))
    fds = []
    for filename in fd.ListNames():
        child_fd = vfs.VFSOpen(rdf_paths.PathSpec(path=os.path.join(path, filename), pathtype=rdf_paths.PathSpec.PathType.OS))
        fd.read(20)
        fds.append(child_fd)
    self.assertTrue(((len(current_process.open_files()) - num_open_files) < 5))
    self.assertGreater(fds, 20)
