【问题标题】:Running command in the background using tox使用 tox 在后台运行命令
【发布时间】:2019-11-10 07:25:36
【问题描述】:

我正在尝试为现有的开源产品实施额外的 CI 程序,但我遇到了一个问题,我不知道如何解决它。

程序背后的想法是下一步。

  • mkdocsmkdocs 生成的文档报告(和失败)是否发出任何警告。
  • mkdocs 在后台使用 serve 子命令运行(类似于在最后使用 & 运行) - 这是在 http://127.0.0.1:8080 上创建带有文档的网络服务器。
  • 我的测试/工具检查正在运行的服务器及其提供的文档。

问题

如何使用tox 让 mkdocs 在后台运行?在我的工具进行自己的测试时,我需要让它继续工作。

我已经尝试做接下来的事情了:

  • 使用 bash 并以
  • 身份运行命令
bash -c 'mkdocs serve --theme readthedocs'

没有失败,网站无法访问。

  • 下一个命令无法使用
  • 运行
mkdocs serve --theme readthedocs 2>&1 > /dev/null &

PS:

【问题讨论】:

    标签: python-3.x testing tox


    【解决方案1】:

    我没有注意到 mkdocs 的问题(该服务器需要一些时间才能启动)。下一个是此场景的工作示例:

    [testenv:docs]
    basepython = python3
    ignore_errors = True
    whitelist_externals = sh
    commands =
        ; -s abort the build on any warnings
        mkdocs build -s --clean --site-dir build/docs/html --theme readthedocs
        ; running mkdocs to serve documentation on 127.0.0.1:3001
        sh -c 'mkdocs serve --dev-addr 0.0.0.0:3001 --theme readthedocs 2>&1 > /dev/null &'
        ; checking liveness
        deadlinks http://127.0.0.1:3001/ -n10 -r3 --no-progress --fiff
    
    deps =
         -r{toxinidir}/requirements_dev.txt
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多