How to run unit tests as sudo?

I have seen other threads that have been told to create a new interpreter.
I have done this

PythonSudo.sh
#!/bin/sh
#Python Interpreter for running tests as root
# user needs sudo NOPASSWD enabled
sudo python "$@"
prettyPrint();

However my Source Roots are not included and the tests fail when importing my modules
How can this be fixed? Or is there now a better way to run tests as sudo?
1 comment
sudo PYTHONPATH=$PYTHONPATH python "$@"
prettyPrint();

Sudo loses PythonPath, this fixes it.
0

Please sign in to leave a comment.