test_arguments.py 文件源码

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

项目:sphinxcontrib-versioning 作者: Robpol86 项目源码 文件源码
def test_overflow(local_empty, push, source_cli, source_conf):
    """Test -- overflow to sphinx-build.

    :param local_empty: conftest fixture.
    :param bool push: Run push sub command instead of build.
    :param bool source_cli: Set value from command line arguments.
    :param bool source_conf: Set value from conf.py file.
    """
    if push:
        args = ['push', 'docs', 'gh-pages', '.']
    else:
        args = ['build', 'docs', join('docs', '_build', 'html')]

    # Setup source(s).
    if source_cli:
        args += ['--', '-D', 'setting=value']
    if source_conf:
        local_empty.ensure('docs', 'contents.rst')
        local_empty.ensure('docs', 'conf.py').write('scv_overflow = ("-D", "key=value")')

    # Run.
    result = CliRunner().invoke(cli, args)
    config = result.exception.args[0]

    # Verify.
    if source_cli:
        assert config.overflow == ('-D', 'setting=value')
    elif source_conf:
        assert config.overflow == ('-D', 'key=value')
    else:
        assert config.overflow == tuple()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号