<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 10:20 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Sep 23, 2014 at 9:21 PM, Romu Hu <span dir="ltr"><<a href="mailto:huruomu@gmail.com" target="_blank">huruomu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm using python27-numpy-f2py-1.7.1-9.el6.x86_64 from RHEL6, the package<br>
has a test directory<br>
"/usr/lib64/python2.7/site-packages/numpy/f2py/tests", when I run<br>
unittest in the directory, all 358 testcases fail:<br>
<br>
# cd /usr/lib64/python2.7/site-packages/numpy/f2py/tests<br>
# python27 -m unittest discover -v<br>
<br>
======================================================================<br>
ERROR: test_c_copy_in_from_23casttype (test_array_from_pyobj.test_BOOL_gen)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
   File "<string>", line 5, in setUp<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 126, in __new__<br>
     obj._init(name)<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 132, in _init<br>
     self.type_num = getattr(wrap,'NPY_'+self.NAME)<br>
AttributeError: 'NoneType' object has no attribute 'NPY_BOOL'<br>
<br>
======================================================================<br>
ERROR: test_c_in_from_23casttype (test_array_from_pyobj.test_BOOL_gen)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
   File "<string>", line 5, in setUp<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 126, in __new__<br>
     obj._init(name)<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 132, in _init<br>
     self.type_num = getattr(wrap,'NPY_'+self.NAME)<br>
AttributeError: 'NoneType' object has no attribute 'NPY_BOOL'<br>
<br>
......<br>
......<br>
<br>
======================================================================<br>
ERROR: test_optional_from_23seq (test_array_from_pyobj.test_USHORT_gen)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
   File "<string>", line 5, in setUp<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 126, in __new__<br>
     obj._init(name)<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 132, in _init<br>
     self.type_num = getattr(wrap,'NPY_'+self.NAME)<br>
AttributeError: 'NoneType' object has no attribute 'NPY_USHORT'<br>
<br>
======================================================================<br>
ERROR: test_optional_from_2seq (test_array_from_pyobj.test_USHORT_gen)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
   File "<string>", line 5, in setUp<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 126, in __new__<br>
     obj._init(name)<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 132, in _init<br>
     self.type_num = getattr(wrap,'NPY_'+self.NAME)<br>
AttributeError: 'NoneType' object has no attribute 'NPY_USHORT'<br>
<br>
======================================================================<br>
ERROR: test_optional_none (test_array_from_pyobj.test_USHORT_gen)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
   File "<string>", line 5, in setUp<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 126, in __new__<br>
     obj._init(name)<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 132, in _init<br>
     self.type_num = getattr(wrap,'NPY_'+self.NAME)<br>
AttributeError: 'NoneType' object has no attribute 'NPY_USHORT'<br>
<br>
======================================================================<br>
ERROR: test_in_out (test_array_from_pyobj.test_intent)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 270, in test_in_out<br>
     assert_equal(str(intent.in_.out),'intent(in,out)')<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 67, in __getattr__<br>
     return self.__class__(self.intent_list+[name])<br>
   File<br>
"/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/f2py/tests/test_array_from_pyobj.py",<br>
line 62, in __init__<br>
     flags |= getattr(wrap,'F2PY_INTENT_'+i.upper())<br>
AttributeError: 'NoneType' object has no attribute 'F2PY_INTENT_IN'<br>
<br>
----------------------------------------------------------------------<br>
Ran 358 tests in 0.047s<br>
<br>
FAILED (errors=358)<br>
<br>
<br>
It seems that all tests fail because the 'wrap' variable is None. Am I<br>
using a wrong way to run the tests?  Any idea?<br>
<br></blockquote><div><br></div></div></div><div>Looks pretty drastic, but I expect the problem is that numpy uses nose for running tests, not unittest. Try<br><br>charris@localhost [tests (master)]$ nosetests<br><br></div><div><snip><br><br></div>----------------------------------------------------------------------<br><div>Ran 379 tests in 12.457s<br><br>OK<br><br></div></div></div></div></blockquote><div>But this doesn't work with the installed package. From ipython, or a terminal, do<br><br>In [8]: np.f2py.test()<br>Running unit tests for numpy.f2py<br>NumPy version 1.10.0.dev-4083883<br>NumPy is installed in /home/charris/.local/lib/python2.7/site-packages/numpy<br>Python version 2.7.5 (default, Jun 25 2014, 10:19:55) [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)]<br>nose version 1.3.0<br>.......................................................................................................................................................................................................................................................................................................................................................................<br>----------------------------------------------------------------------<br>Ran 359 tests in 1.737s<br><br>OK<br> <br></div>Chuck<br></div></div></div>