def initdb(drop, _init): """初始化数据库""" if drop: click.confirm('确定要删除所有数据表?', abort=True) db.drop_all() click.echo('数据表删除成功') if _init: db.drop_all() click.echo('数据表删除成功') db.create_all() # 初始化数据后在分类表中添加一条记录作为默认默认分类 with db.auto_commit(): category = Category() category.name = '未分类' category.show = False db.session.add(category) click.echo('数据表已成功创建')
def tearDown(self) -> None: """测试结束后执行""" db.drop_all() self.context.pop() shutil.rmtree(os.path.join(basedir, 'test/whooshee'))
def tearDown(self): db.drop_all() self.context.pop()
def setUp(self): super().setUp() db.drop_all()