'Using python tox in a continous integration solution without installing tox as root?
I do like self contained solutions and being able to run the unittests without having to install anything on the machine.
This would allow me to test the python packages on several machines without having to prepare them for this.
Is it possible (how?) to use tox to run python unittests without installing it to the machines (so root access).
Solution 1:[1]
You could perhaps use virtualenv for this, especially if you have a relatively recent version of Python.
That would allow you to create a sandbox environment with whatever packages you need, share it across environments, and run what you need to run.
Another approach (a bit more "complicated"), would be to use a VM solution like Vagrant to set up a sandboxed environment that could be run mostly anywhere. It does require installing and configuration, but it's a one time thing, and can then be used to set up whatever environment you need without messing with the actual system libraries of each machine.
These are just general approaches I would consider, you'll know better what applies to your case since you have knowledge of the actual restrictions and architecture you're using.
I think a virtualenv setup could really be the way to go, you can make it depend on the system packages as a base, and then install tox on top of the sandbox:
http://www.virtualenv.org/en/latest/#the-system-site-packages-option
Solution 2:[2]
You could try to download and use toxbootstrap.py which is an auto-installing tox script. It downloads and creates all that is neccessary, working from your tox.ini.
Solution 3:[3]
eemz@r66:/tmp$ python3 -m pip install --user --upgrade tox
eemz@r66:/tmp$ which tox
/home/eemz/.local/bin/tox
eemz@r66:/tmp$ tox --version
3.25.0 imported from /home/eemz/.local/lib/python3.8/site-packages/tox/__init__.py
I think this is what you are asking for. A means to install tox for the current user, don't need root access to the machine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | hpk42 |
| Solution 3 | eemz |
