test_models.py 文件源码

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

项目:trio2o 作者: openstack 项目源码 文件源码
def test_resources(self):
        """Create all the resources to test model definition"""
        try:
            model_list = []
            for _, model_class in inspect.getmembers(models):
                if inspect.isclass(model_class) and (
                        issubclass(model_class, core.ModelBase)):
                    model_list.append(model_class)
            for model_class in _sort_model_by_foreign_key(model_list):
                create_dict = _construct_resource_dict(model_class)
                with self.context.session.begin():
                    core.create_resource(
                        self.context, model_class, create_dict)
        except Exception as e:
            msg = str(e)
            self.fail('test_resources raised Exception unexpectedly %s' % msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号