0

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).

sorin
  • 161,544
  • 178
  • 535
  • 806

3 Answers3

2

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

pcalcao
  • 15,789
  • 1
  • 44
  • 64
  • Mainly I am looking to obtain a setup where you can just checkout the code and run the tests with the local version of python you have on the system, without having to install anything on the machine. This would allow me to run on Jenkins slaves, or something similar. – sorin Apr 17 '13 at 11:19
  • 1
    Updated with a link to a virtualenv option that I think might be handy to you. – pcalcao Apr 17 '13 at 11:24
1

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.

hpk42
  • 21,501
  • 4
  • 47
  • 53
0
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.

eemz
  • 1,183
  • 6
  • 10