test_core.py 文件源码

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

项目:paper-to-git 作者: maxking 项目源码 文件源码
def test_initialize_2(self, tmpdir_factory):
        var_dir = tmpdir_factory.mktemp('temp_var')
        test_config = var_dir.join('paper-git.cfg')
        with test_config.open(ensure=True, mode='w') as fp:
            print("""
[dropbox]
api_token: thisisanotherapikey
            """, file=fp)
        assert config.dbox is None
        assert config.db.path is None
        with pytest.raises(peewee.OperationalError):
            config.db.db.connect()
        with var_dir.as_cwd():
            initialize()
        # Make sure that the database connection works.
        assert config.db.path is not None
        assert set(config.db.db.get_tables()) == set([
            'paperdoc', 'paperfolder', 'sync'])
        assert config.dbox is not None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号