base.py 文件源码

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

项目:pyramid_runner 作者: asif-mahmud 项目源码 文件源码
def __init_database(self):
        """Initialize the database models.

        Define a method called `init_db` to initialize
        any database instance. This method will automatically
        be called at `setUp`.

        Caution: If `init_db` is defined, a `clean_db` method
        should also be defined which will be called at
        `tearDown`.
        """
        meta.Base.metadata.create_all(self.engine)

        try:
            __init_db = self.__getattribute__('init_db')
            if callable(__init_db):
                with transaction.manager:
                    __init_db()
        except AttributeError:
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号