When I try to run a test command using sudo python ..., tox uses the system Python instead of the tox-specified version. How can I run commands in sudo using tox?
commands =
sudo python -m pytest # always runs system python!
python in Tox commands will only be replaced if it is a command. Technically, sudo python ... will run the system command sudo and pass it "python" as the first argument.
Tox provides a number of substitutions that allow for a lot of flexibility. In your case, you'll want something like
commands =
sudo {envpython} -m pytest # always uses the right python :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With