[TIP] tox and pypy and numpypy
Albert-Jan Roskam
fomcl at yahoo.com
Tue Nov 25 04:14:31 PST 2014
[Re-post, as I did not see my reply on the list. Apologies if you see this message twice]
-----------------------------
On Fri, Nov 21, 2014 8:49 PM CET Albert-Jan Roskam wrote:
>
>
>----- Original Message -----
>
>> From: Tres Seaver <tseaver at palladion.com>
>> To: testing-in-python at lists.idyll.org
>> Cc:
>> Sent: Friday, November 21, 2014 5:54 PM
>> Subject: Re: [TIP] tox and pypy and numpypy
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 11/21/2014 03:08 AM, Albert-Jan Roskam wrote:
>>
>> I am using the latest version of Tox and I would like to include Pypy
>> in my list of environments. One of the required packages is numpy.
>> Currently, tox tries to pip install the standard numpy (which fails),
>> not numpypy. What is the correct way to solve this? I just read about
>> 'use_sitepackages=True', which might be an option.
>>
>> You can set up the 'deps' for the environment differently. E.g.:
>>
>>
>> - ------------------------- %< --------------------------
>> [tox]
>> envlist = py26,py27,pypy
>>
>> [testenv]
>> deps =
>> nose
>> numpy
>> commands =
>> nosetests
>>
>> [testenv:pypy]
>> deps =
>> nose
>>
>> numpypy
>> commands =
>> nosetests
>> - ------------------------- %< --------------------------
>>
>
>
>hi,
>
>Thanks, you put me on the right track. Numpypy and the normal numpy are both called 'numpy' though.
>
>I got it working with a separate 'dep', like you suggested, and by using the (experimental) 'install_command'
>
>
>[tox]
>envlist = pypy,py27,py33,py34,docs
>skipsdist = True
>
>[testenv]
>deps =
> setuptools
> nose
> gocept.testing
> numpy
>commands =
>nosetests --with-xunit --xunit-file=junit-{envname}.xml --verbosity=3
>
>[testenv:pypy]
>deps =
> setuptools
> nose
> gocept.testing
>install_command =
> pip install git+https://bitbucket.org/pypy/numpy.git {packages}
>
>
>And it was worth the effort, because numpypy apparently does not 'upcast' arrays with mixed data types. This is with regular numpy (notice the ints become str, upcasting):
>>> numpy.array([['a', 1], ['b', 2]])
>array([['a', '1'],
>['b', '2']],
>dtype='|S1')
>
>regards,
>Albert-Jan
More information about the testing-in-python
mailing list