tox aims to automate and standardize testing in Python. It is part of a larger vision of easing the packaging, testing and release process of Python software.
Tox is a generic virtualenv management and test command line tool you can use for:
First, install tox with pip install tox or easy_install tox. Then put basic information about your project and the test environments you want your project to run in into a tox.ini file residing right next to your setup.py file:
# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = py26,py27
[testenv]
deps=pytest # install pytest in the venvs
commands=py.test # or 'nosetests' or ...
You can also try generating a tox.ini file automatically, by running tox-quickstart and then answering a few simple questions.
To sdist-package, install and test your project against Python2.6 and Python2.7, just type:
tox
and watch things happening (you must have python2.6 and python2.7 installed in your environment otherwise you will see errors). When you run tox a second time you’ll note that it runs much faster because it keeps track of virtualenv details and will not recreate or re-install dependencies. You also might want to checkout tox configuration and usage examples to get some more ideas.
automation of tedious Python related test activities
test your Python package against many interpreter and dependency configs
- automatic customizable (re)creation of virtualenv test environments
- installs your setup.py based project into each virtual environment
- test-tool agnostic: runs py.test, nose or unittests in a uniform manner
uses pip and setuptools by default. Experimental support for configuring the installer command through install_command=ARGV.
cross-Python compatible: CPython-2.6, 2.7, 3.2 and higher, Jython and pypy.
cross-platform: Windows and Unix style environments
integrates with continuous integration servers like Jenkins (formerly known as Hudson) and helps you to avoid boilerplatish and platform-specific build-step hacks.
full interoperability with devpi: is integrated with and is used for testing in the devpi system, a versatile pypi index server and release managing tool.
driven by a simple ini-style config file
documented examples and configuration
concise reporting about tool invocations and configuration errors
professionally supported