【问题标题】:tox run python command in sudotox 在 sudo 中运行 python 命令
【发布时间】:2016-04-14 20:06:57
【问题描述】:

当我尝试使用sudo python ... 运行测试命令时,tox 使用系统 Python 而不是 tox 指定的版本。如何使用 tox 在 sudo 中运行命令?

commands =
    sudo python -m pytest  # always runs system python!

【问题讨论】:

    标签: python tox


    【解决方案1】:

    Tox 命令中的python 只有在它是命令时才会被替换。从技术上讲,sudo python ... 将运行系统命令sudo 并将“python”作为第一个参数传递。

    Tox 提供了许多substitutions,它们提供了很大的灵活性。在你的情况下,你会想要类似的东西

    commands =
        sudo {envpython} -m pytest  # always uses the right python :)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-29
      • 2011-01-29
      相关资源
      最近更新 更多