[TIP] [tox] getting started

Eugene Van den Bulke eugene.vandenbulke at gmail.com
Sun Oct 14 00:04:20 PDT 2012


Hi,

I have just released a small package (module really)
http://pypi.python.org/pypi/constants that now runs on both Python 2.7
and Python 3.3.

My tests are pretty simple but I figured it would be a great
opportunity to get started with tox but sadly I have been banging my
head against my keyboard :(

My tox.ini is:

[tox]
envlist = py27, py33
[testenv]
deps=pytest
commands=py.test

My "default" python is 2.7. I installed 3.3 to port constants.

First I tried to install tox in a virtualenv (2.7) and call $ tox. It
worked fine for 2.7 but failed for 3.3 trying to create a virtualenv
in 3.3 with the virtualenv in 2.7.

I thought it might be because I was running tox in a virtualenv so I
installed it globally but then it failed for both 2.7 and 3.3 trying
to create a virtualenv with the 2.5 library (I am on Mac OS Snow
Leopard).

I have the gutt feeling it is something rather silly I am sadly
missing. Below is the errors I get in the first case (it is similar in
the second case):

ERROR: invocation failed, logfile:
/Users/eugene/Code/constants/.tox/py33/log/py33-0.log
ERROR: actionid=py33
msg=getenv
cmdargs=['/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3',
'/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py',
'py33']
env={'TERM_PROGRAM_VERSION': '273.1', 'LOGNAME': 'eugene', 'USER':
'eugene', 'PATH':
'/Users/eugene/Code/constants/.tox/py33/bin:/Users/eugene/Envs/tox/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Users/eugene/Code/hubify/bin:/Users/eugene/local/node/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:/usr/X11/bin',
'HOME': '/Users/eugene', 'PS1': '(tox)\\W$(__git_ps1 "[%s]")\\\\$ ',
'DISPLAY': '/tmp/launch-y1X7GF/org.x:0', 'TERM_PROGRAM':
'Apple_Terminal', 'LANG': 'en_AU.UTF-8', 'TERM': 'xterm-color',
'Apple_PubSub_Socket_Render': '/tmp/launch-GFBHtX/Render', 'QHOME':
'/opt/q', 'SHLVL': '1', 'MACOSX_DEPLOYMENT_TARGET': '10.6', '_':
'/Users/eugene/Envs/tox/bin/tox', 'WORKON_HOME': '/Users/eugene/Envs',
'PYTHONPATH': '.:', 'SSH_AUTH_SOCK': '/tmp/launch-7HskIQ/Listeners',
'VIRTUAL_ENV': '/Users/eugene/Envs/tox', 'SHELL': '/bin/bash',
'TMPDIR': '/var/folders/2n/2nToe6v5FA4M24X0ANWXB++++TI/-Tmp-/',
'OLDPWD': '/Users/eugene', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0',
'PWD': '/Users/eugene/Code/constants', 'COMMAND_MODE': 'unix2003'}
Traceback (most recent call last):
  File "/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py",
line 2471, in <module>
    main()
  File "/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py",
line 942, in main
    never_download=options.never_download)
  File "/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py",
line 1043, in create_environment
    site_packages=site_packages, clear=clear))
  File "/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py",
line 1207, in install_python
    copy_required_modules(home_dir)
  File "/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py",
line 1159, in copy_required_modules
    dst_filename = change_prefix(filename, dst_prefix)
  File "/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py",
line 1134, in change_prefix
    (filename, prefixes)
AssertionError: Filename
/Users/eugene/Envs/tox/lib/python2.7/site-packages/readline.so does
not start with any of these prefixes:
['/Library/Frameworks/Python.framework/Versions/3.3',
'/Library/Python/3.3/site-packages',
'/Library/Frameworks/Python.framework/Versions/3.3/Extras/lib/python',
'/Users/eugene/Library/Python/3.3/site-packages',
'/Users/eugene/.local/lib/python/3.3/site-packages',
'/Users/eugene/Library/Python/3.3/lib/python/site-packages']

ERROR: InvocationError:
/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3
/Users/eugene/Envs/tox/lib/python2.7/site-packages/virtualenv.py py33
(see /Users/eugene/Code/constants/.tox/py33/log/py33-0.log)

Help would be greatly appreciated.

Regards,

-- 
EuGeNe -- follow me http://twitter.com/3kwa



More information about the testing-in-python mailing list