tox.ini
1 2 3 4 5 6 7 | [tox] envlist = py27 [testenv] deps = pytest commands = py.test sitepackages = true |
setup.py
1 2 3 4 5 6 7 8 9 | from setuptools import setup setup( name='mypkg', version='0.1', packages=['mypkg'], url='', install_requires=['distribute'], ) |
mypkg/__init__.py
1 |
mypkg/foo.py
1 2 | def f(x): return 2 ** x |
mypkg/test_foo.py
1 2 3 4 5 6 7 | from mypkg.foo import f def test_foo(): assert f(0) == 1 assert f(1) == 2 assert f(2) == 4 assert f(3) == 8 |
stderr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ~/Desktop/tox-example% tox GLOB sdist-make: /home/derdon/Desktop/tox-example/setup.py py27 create: /home/derdon/Desktop/tox-example/.tox/py27 py27 installdeps: pytest py27 sdist-inst: /home/derdon/Desktop/tox-example/.tox/dist/mypkg-0.1.zip py27 runtests: commands[0] WARNING:test command found but not installed in testenv cmd: /usr/local/bin/py.test env: /home/derdon/Desktop/tox-example/.tox/py27 Maybe forgot to specify a dependency? ============================= test session starts ============================= platform linux2 -- Python 2.6.8 -- pytest-2.3.4 collected 0 items / 1 errors =================================== ERRORS ==================================== _____________________ ERROR collecting tests/test_foo.py ______________________ tests/test_foo.py:1: in <module> > from mypkg.foo import f E ImportError: No module named mypkg.foo =========================== 1 error in 0.05 seconds =========================== ERROR: InvocationError: '/usr/local/bin/py.test' ___________________________________ summary ___________________________________ ERROR: py27: commands failed |