__init__.py 文件源码

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

项目:webspider 作者: GuozhuHe 项目源码 文件源码
def setUp(self):
        # ???????
        try:
            self.session.execute("DROP DATABASE test_spider;")
        except OperationalError as e:
            logging.warning(e)
        self.session.execute("CREATE DATABASE test_spider CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
        # ??????? test_spider
        self.session.execute("USE test_spider;")
        path = os.path.dirname(__file__)
        execute_sql_file(
            file_paths=[os.path.join(path, "schema.sql"), ],
            db_session=self.session
        )
        fixture_path = os.path.join(path, 'fixture')
        # ?? fixture ?? SQL ??......
        fixture_file_paths = [os.path.join(fixture_path, file) for file in os.listdir(fixture_path)]
        execute_sql_file(
            file_paths=fixture_file_paths,
            db_session=self.session
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号