First, install tox with pipinstalltox.
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=py27,py36[testenv]deps=pytest# install pytest in the venvscommands=pytest# 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.7 and Python3.6, just type:

tox

and watch things happening (you must have python2.7 and python3.6 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.