horcrux
horcrux

Reputation: 11

Tox Invocation Error while trying to run command 'sudo tox'

While working in an virtualenv [3.4] I was trying to run tox for running the tests when I got the error:

py34 develop-inst-nodeps: /home/horcrux/dir-sub/dir
py34 runtests: commands[0] | python -m nose2 -v
/home/horcrux/dir-sub/dir/.tox/py34/bin/python: No module named nose2
ERROR: InvocationError: '/home/horcrux/dir-sub/dir/.tox/py34/bin/python -m nose2 -v'
_____________________________ summary ______________________________________
ERROR:   py34: commands failed

I've already tried to install nose2 using pip install nose2 but still the problem remains the same.

Upvotes: 0

Views: 3031

Answers (1)

David K. Hess
David K. Hess

Reputation: 17246

sudo clears the environment. You have to invoke the virtualenv inside of the sudo execution environment. Try:

sudo bash -c ". [venv/bin/activate] ; [tox]"

Replace [venv/bin/activate] with the path to your virtualenv activate script and replace [tox] with whatever command you are using to invoke it.

Upvotes: 1

Related Questions