la.test() doesn't run any tests.

16 views
Skip to first unread message

Travis Ruthenburg

unread,
May 16, 2012, 8:06:51 PM5/16/12
to labeled-array
Hello,

I've just installed and begun using labeled-array. First, thanks for
this great package!

So far, larrys seem to be behaving as expected, but when I try to run
la.test(), it doesn't appear to run any tests.

>>> import la
>>> la.test()
Running unit tests for la
NumPy version 1.6.1
NumPy is installed in /Library/Frameworks/Python.framework/Versions/
7.1/lib/python2.7/site-packages/numpy
Python version 2.7.2 |EPD 7.1-2 (32-bit)| (default, Jul 27 2011,
13:29:32) [GCC 4.0.1 (Apple Inc. build 5493)]
nose version 1.0.0

----------------------------------------------------------------------
Ran 0 tests in 0.003s

OK
<nose.result.TextTestResult run=0 errors=0 failures=0>


Regards,

Travis

Keith Goodman

unread,
May 16, 2012, 11:26:51 PM5/16/12
to labele...@googlegroups.com
On Wed, May 16, 2012 at 5:06 PM, Travis Ruthenburg
<travi...@gmail.com> wrote:

> So far, larrys seem to be behaving as expected, but when I try to run
> la.test(), it doesn't appear to run any tests.

I have no idea why no tests ran. So let's start with some top level diagnostics.

What does la.info() return?

In [1]: import la
In [2]: la.info()
la 0.7.0dev
la file la/__init__.pyc
NumPy 1.6.1
Bottleneck 0.6.0dev
HDF5 archiving Not available
listmap Faster C version
listmap_fill Faster C version

Do you have a directory named la/la/tests? And does it contain a bunch
of python files:

la/la/tests$ ls
all_nan_test.py empty_larry_test.py missing_test.py
deflarry_creation_test.py flabel_test.py more_test.py
deflarry_move_test.py flarry_test.py slicing_test.py
deflarry_nose_test.py io_test.py test_3d.py
deflarry_test.py larry_axis_test.py
deflarry_unary_test.py lix_test.py

Travis Ruthenburg

unread,
May 17, 2012, 2:21:06 AM5/17/12
to labele...@googlegroups.com, Keith Goodman
Hi,

Thanks for the quick response. Included is the la.info() output and a directory listing for the test directory. I think I installed la with easy_install.

>>> la.info()
la 0.6.0
la file /Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/__init__.pyc
NumPy 1.6.1
Bottleneck 0.5.0
HDF5 archiving Available (h5py 2.0.0)
listmap Faster C version
listmap_fill Faster C version

$ ls /Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/tests
all_nan_test.py flabel_test.py missing_test.py
all_nan_test.pyc flabel_test.pyc missing_test.pyc
deflarry_move_test.py flarry_test.py more_test.py
deflarry_move_test.pyc flarry_test.pyc more_test.pyc
deflarry_nose_test.py io_test.py slicing_test.py
deflarry_nose_test.pyc io_test.pyc slicing_test.pyc
deflarry_test.py larry_axis_test.py test_3d.py
deflarry_test.pyc larry_axis_test.pyc test_3d.pyc
empty_larry_test.py lix_test.py
empty_larry_test.pyc lix_test.pyc

Regards,

Travis

Skipper Seabold

unread,
May 17, 2012, 9:00:59 AM5/17/12
to labele...@googlegroups.com
On Thu, May 17, 2012 at 2:21 AM, Travis Ruthenburg
<travi...@gmail.com> wrote:
> Hi,
>
> Thanks for the quick response. Included is the la.info() output and a directory listing for the test directory. I think I installed la with easy_install.
>

Could you try

la.test(extra_argv=['--exe'])

Skipper

Travis Ruthenburg

unread,
May 17, 2012, 10:44:08 AM5/17/12
to labele...@googlegroups.com
Hi Skipper,

Thanks, that did the trick.

Regards,

Travis

In [17]: la.test(extra_argv=['--exe'])
Running unit tests for la
NumPy version 1.6.1
NumPy is installed in /Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/numpy
Python version 2.7.2 |EPD 7.1-2 (32-bit)| (default, Jul 27 2011, 13:29:32) [GCC 4.0.1 (Apple Inc. build 5493)]
nose version 1.0.0
/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/farray/misc.py:117: RuntimeWarning: invalid value encountered in double_scalars
x1 = x1 - x1.mean()
/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/farray/misc.py:118: RuntimeWarning: invalid value encountered in double_scalars
x2 = x2 - x2.mean()
/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/farray/misc.py:134: RuntimeWarning: invalid value encountered in double_scalars
return num / den
./Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/farray/misc.py:93: RuntimeWarning: invalid value encountered in double_scalars
x1 = x1 - x1.mean()
/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/la-0.6.0-py2.7-macosx-10.5-i386.egg/la/farray/misc.py:94: RuntimeWarning: invalid value encountered in double_scalars
x2 = x2 - x2.mean()
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
FAIL: Test larry methods for proper handling of empty larrys
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/nose/case.py", line 187, in runTest
self.test(*self.arg)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/numpy/testing/utils.py", line 34, in assert_
raise AssertionError(msg)
AssertionError: Type of 'actual' and 'desired' do not match for 'nx'

----------------------------------------------------------------------
Ran 3063 tests in 3.399s

FAILED (failures=1)
Out[17]: <nose.result.TextTestResult run=3063 errors=0 failures=1>

Keith Goodman

unread,
May 17, 2012, 10:57:06 AM5/17/12
to labele...@googlegroups.com
On Thu, May 17, 2012 at 7:44 AM, Travis Ruthenburg
<travi...@gmail.com> wrote:

> ======================================================================
> FAIL: Test larry methods for proper handling of empty larrys
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/nose/case.py", line 187, in runTest
>    self.test(*self.arg)
>  File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/numpy/testing/utils.py", line 34, in assert_
>    raise AssertionError(msg)
> AssertionError: Type of 'actual' and 'desired' do not match for 'nx'

Huh, what does this give:

I[1] type(la.larry([]).nx)
O[1] numpy.int64
I[2] type(np.array([0])[0])
O[2] numpy.int64


> On May 17, 2012, at 6:00 AM, Skipper Seabold wrote:
>>
>> Could you try
>>
>> la.test(extra_argv=['--exe'])
>>
>> Skipper

Nice! Looks like magic. What does it do? On my computer the tests run
with or without it.

Travis Ruthenburg

unread,
May 17, 2012, 11:03:53 AM5/17/12
to labele...@googlegroups.com
In [4]: type(la.larry([]).nx)
Out[4]: numpy.int32
In [7]: type(np.array([0])[0])
Out[7]: numpy.int32

Skipper Seabold

unread,
May 17, 2012, 11:21:33 AM5/17/12
to labele...@googlegroups.com
On Thu, May 17, 2012 at 10:57 AM, Keith Goodman <kwgo...@gmail.com> wrote:
>> On May 17, 2012, at 6:00 AM, Skipper Seabold wrote:
>>>
>>> Could you try
>>>
>>> la.test(extra_argv=['--exe'])
>>>
>>> Skipper
>
> Nice! Looks like magic. What does it do? On my computer the tests run
> with or without it.

http://readthedocs.org/docs/nose/en/latest/usage.html?highlight=exe#cmdoption--exe

Setuptools installs python scripts with an executable flag and nose
does not run these by default in most versions. AFAIK most projects
monkey patch numpy.testing.Tester. Something like

https://github.com/statsmodels/statsmodels/blob/master/statsmodels/__init__.py#L27

Skipper

Keith Goodman

unread,
May 17, 2012, 11:33:02 AM5/17/12
to labele...@googlegroups.com
On Thu, May 17, 2012 at 8:03 AM, Travis Ruthenburg
<travi...@gmail.com> wrote:
> In [4]: type(la.larry([]).nx)
> Out[4]: numpy.int32
> In [7]: type(np.array([0])[0])
> Out[7]: numpy.int32

OK, I think this is a numpy bug. Try:

I[1] type(la.larry([]).nx) == type(np.array([0])[0])
O[1] True

Travis Ruthenburg

unread,
May 17, 2012, 1:18:36 PM5/17/12
to labele...@googlegroups.com
On May 17, 2012, at 8:33 AM, Keith Goodman wrote:
>
> OK, I think this is a numpy bug. Try:
>
> I[1] type(la.larry([]).nx) == type(np.array([0])[0])
> O[1] True

In [13]: type(la.larry([]).nx) == type(np.array([0])[0])
Out[13]: False

I'm using bumpy 1.6.1 via EPD 7.1-2
Reply all
Reply to author
Forward
0 new messages