【问题标题】:Python tox dependencies installation outputPython tox 依赖项安装输出
【发布时间】:2016-05-03 11:59:03
【问题描述】:

在使用pip 安装依赖项时,是否可以使用tox 避免将输出重定向到文件?我想看看正在安装什么,所以我想登录到标准输出而不是文件。

【问题讨论】:

    标签: python testing tox


    【解决方案1】:

    如果您想查看每次运行都安装了什么,使用pip freeze 怎么样?您可以将其添加到 commands 部分,它将以需求格式转储已安装的软件包。

    commands =
        pip freeze
        ... rest of your commands here.
    

    我经常使用这种策略来执行类似python echo_versions.py 之类的操作,其中echo_versions.py 是一个小脚本,它显示每次运行我感兴趣的包的版本 - 只是为了确保安装了预期的包。

    【讨论】:

      【解决方案2】:

      我通过在tox.ini 中添加更改install_command 来解决,如下所示:

      install_command = ./install_deps {opts} {packages}
      

      install_deps 在哪里:

      #!/bin/sh
      # This script is used as `install_command` for `tox` in order to log to stdout
      # the requirements that are being installed.
      
      pip install $@ | tee /dev/tty
      

      【讨论】:

        猜你喜欢
        • 2015-05-30
        • 2023-04-06
        • 2015-07-04
        • 2020-06-08
        • 2016-08-21
        • 2021-10-15
        • 2017-12-11
        • 2021-03-04
        • 1970-01-01
        相关资源
        最近更新 更多