[英]tox run python command in sudo
When I try to run a test command using sudo python ...
, tox uses the system Python instead of the tox-specified version. 当我尝试使用
sudo python ...
运行测试命令时,tox使用系统Python而不是tox指定的版本。 How can I run commands in sudo using tox? 如何使用tox在sudo中运行命令?
commands =
sudo python -m pytest # always runs system python!
python
in Tox commands will only be replaced if it is a command. 仅当Tox命令中的
python
是命令时才会被替换。 Technically, sudo python ...
will run the system command sudo
and pass it "python" as the first argument. 从技术上讲,
sudo python ...
将运行系统命令sudo
并将其传递给“ python”作为第一个参数。
Tox provides a number of substitutions that allow for a lot of flexibility. Tox提供了许多替代方案 ,这些替代方案具有很大的灵活性。 In your case, you'll want something like
就您而言,您会想要类似
commands =
sudo {envpython} -m pytest # always uses the right python :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.