test_email.py 文件源码

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

项目:MKFQ 作者: maojingios 项目源码 文件源码
def test_make_msgid_collisions(self):
        # Test make_msgid uniqueness, even with multiple threads
        class MsgidsThread(Thread):
            def run(self):
                # generate msgids for 3 seconds
                self.msgids = []
                append = self.msgids.append
                make_msgid = Utils.make_msgid
                clock = time.time
                tfin = clock() + 3.0
                while clock() < tfin:
                    append(make_msgid())

        threads = [MsgidsThread() for i in range(5)]
        with start_threads(threads):
            pass
        all_ids = sum([t.msgids for t in threads], [])
        self.assertEqual(len(set(all_ids)), len(all_ids))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号