【问题标题】:Running Sphinx via tox通过 tox 运行 Sphinx
【发布时间】:2017-11-10 14:00:38
【问题描述】:

我有一个 tox 配置,允许我对文档进行一些检查。这或多或少来自official documentation on tox

[tox]
envlist = py36, flake8, docs

[testenv:docs]
basepython=python3.6
changedir=docs  # ← causes sphinx-apidoc to misbehave.
deps=-r{toxinidir}/requirements/requirements.txt
commands=
    sphinx-apidoc --force --separate --private --module-first -o docs site '*/*test*' '*/*migration*'
    pytest --maxfail=1 --tb=line -v --junitxml=junit_{envname}.xml check_sphinx.py

但是,第一个命令 (sphinx-apidoc …) 需要在项目的根目录中运行,否则排除模式不起作用。尽管我尝试了许多可能的变化。第二个命令需要在docs 目录中运行。

如何让这两个命令在不同的目录中运行?

【问题讨论】:

    标签: python python-3.x python-sphinx tox


    【解决方案1】:

    commands指向一个shell脚本,例如

    #!/bin/bash
    
    set -eux
    
    sphinx-apidoc --force --separate --private --module-first -o docs site '*/*test*' '*/*migration*'
    cd docs
    pytest --maxfail=1 --tb=line -v --junitxml=junit_{envname}.xml check_sphinx.py
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-26
      • 1970-01-01
      • 2018-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-29
      相关资源
      最近更新 更多