test_cache_system.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:zmirror 作者: aploium 项目源码 文件源码
def test_io_and_many_files(self):
        import os
        from time import time

        start = time()
        for i in range(10000):  # ?????????????
            obj = os.urandom(16 * 1024)
            self.cache.put_obj(i, obj, info_dict={"bin": obj})
        for i in range(10000):
            info = self.cache.get_info(i)
            obj = self.cache.get_obj(i)
            self.assertEqual(info['bin'], obj)
        print("test_io_and_many_files IO total time:", time() - start)

        # test clean delete
        all_cache_file_path = [v[0] for v in self.cache.items_dict.values()]
        start = time()
        del self.cache
        print("test_io_and_many_files DELETE ALL total time:", time() - start)
        for path in all_cache_file_path:
            self.assertFalse(os.path.exists(path), msg=path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号