test_config.py 文件源码

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

项目:markdownreveal 作者: markdownreveal 项目源码 文件源码
def test_load_config_local():
    """
    Test `load_config()` with local configuration file.
    """
    with TemporaryDirectory() as tmpdir:
        tmpdir = Path(tmpdir)
        # Change home directory for testing
        os.environ['MARKDOWNREVEAL_HOME'] = str(tmpdir)
        # Create local configuration file
        config_file = tmpdir / 'config.yaml'
        config_file.write_text('footer: "local footer"\n'
                               'header: "local header"\n'
                               'style: "https://other/style/file.tar.gz"')
        # Load configuration
        old = Path.cwd()
        os.chdir(str(tmpdir))
        config = load_config()
        os.chdir(str(old))

    assert config['local_path'] == tmpdir / '.markdownreveal'
    assert config['output_path'] == config['local_path'] / 'out'
    assert config['footer'] == 'local footer'
    assert config['header'] == 'local header'
    assert 'other/style' in config['style']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号