conftest.py 文件源码

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

项目:unsonic 作者: redshodan 项目源码 文件源码
def bootstrap(dbinfo):
    # Initialize the db layer
    config = testing.setUp()
    settings = config.get_settings()
    here = "/".join(os.path.dirname(__file__).split("/")[:-2])
    global_settings = {"__file__": os.path.join(here, "test/testing.ini"),
                       "here": here, "venv":CONFIG.venv()}
    web.init(global_settings, settings, dbinfo)

    # Sync the database with mishmash
    __main__.main(["-D", dbinfo.url, "-c", "test/testing.ini", "sync"])

    # Create test users
    session = dbinfo.SessionMaker()
    user = models.addUser(session, "test", "test", auth.Roles.def_user_roles)
    user.avatar = 3
    session.add(user)
    session.commit()
    session.close()

    # Load the users
    models.load()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号