base.py 文件源码

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

项目:django-tree 作者: BertrandBordage 项目源码 文件源码
def run_tests(self, tested_model, count):
        connection = connections[self.current_db_alias]
        for (test_name, model, y_label), test_class in self.tests.items():
            if model is not tested_model:
                continue
            benchmark_test = test_class(self, model)
            with transaction.atomic(using=self.current_db_alias):
                try:
                    benchmark_test.setup()
                except SkipTest:
                    value = elapsed_time = None
                else:
                    start = time()
                    value = benchmark_test.run()
                    elapsed_time = time() - start
                connection.needs_rollback = True
            if value is None:
                value = elapsed_time
            self.add_data(model, test_name, count, value, y_label=y_label)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号