[SciPy-Dev] scipy.test() failures '0.9.0.dev6635'

Warren Weckesser warren.weckesser@enthought....
Wed Jul 21 16:52:07 CDT 2010


Sorry for talking to myself as I learn more
about the warnings module...

Warren Weckesser wrote:
> Warren Weckesser wrote:
>   
>> Nils Wagner wrote:
>>   
>>     
>>> ======================================================================
>>> FAIL: test_mio.test_mat4_3d(<type 
>>> 'exceptions.DeprecationWarning'>, <functools.partial 
>>> object at 0x3081680
>>>   
>>>     
>>>       
>>>> , <StringIO.StringIO instance at 0x5096bd8>, {'a': array([[[ 0,  1,  2,  3],
>>>>     
>>>>       
>>>>         
>>> ----------------------------------------------------------------------
>>> Traceback (most recent call last):
>>>    File 
>>> "/home/nwagner/local/lib64/python2.6/site-packages/nose-0.11.2.dev-py2.6.egg/nose/case.py", 
>>> line 18
>>> 3, in runTest
>>>      self.test(*self.arg)
>>>    File 
>>> "/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/utils.py", 
>>> line 982, in assert_rai
>>> ses
>>>      return nose.tools.assert_raises(*args,**kwargs)
>>> AssertionError: DeprecationWarning not raised
>>>      if hasattr(excClass,'__name__'): 'DeprecationWarning' 
>>> = excClass.'unittest'
>>>      else: 'DeprecationWarning' = str(excClass)
>>>   
>>>     
>>>       
>>>>>  raise self.failureException, "%s not raised" % 'DeprecationWarning'
>>>>>       
>>>>>         
>>>>>           
>>> ======================================================================
>>> FAIL: test_00_deprecation_warning 
>>> (test_basic.TestSolveHBanded)
>>> ----------------------------------------------------------------------
>>> Traceback (most recent call last):
>>>    File 
>>> "/home/nwagner/local/lib64/python2.6/site-packages/scipy/linalg/tests/test_basic.py", 
>>> line 262, in
>>> test_00_deprecation_warning
>>>      assert_raises(DeprecationWarning, solveh_banded, ab, 
>>> b)
>>>    File 
>>> "/home/nwagner/local/lib64/python2.6/site-packages/numpy/testing/utils.py", 
>>> line 982, in assert_rai
>>> ses
>>>      return nose.tools.assert_raises(*args,**kwargs)
>>> AssertionError: DeprecationWarning not raised
>>>      if hasattr(excClass,'__name__'): 'DeprecationWarning' 
>>> = excClass.'unittest'
>>>      else: 'DeprecationWarning' = str(excClass)
>>>   
>>>     
>>>       
>>>>>  raise self.failureException, "%s not raised" % 'DeprecationWarning'
>>>>>       
>>>>>         
>>>>>           
>>>   
>>>     
>>>       
>> These two errors are failures to raise a deprecation warning.
>> Does anyone else get these?
>>
>> I wrote the test test_00_deprecation_warning in test_basic.py,
>> one of the linalg test modules.  In SciPy 0.8 and currently
>> in the trunk, the function solveh_banded is supposed to
>> raise a deprecation warning, because in the final release
>> of 0.9, its return value will be changed.
>>
>> The tests for solveh_banded work for me, but they might
>> be taking advantage of behavior of nose that is not
>> reliable.  In effect, test_00_deprecation_warning assumes
>> that will execute the first call of solveh_banded, so
>> the deprecation warning will occur.  All the other test
>> functions include the line
>>     warnings.simplefilter('ignore', category=DeprecationWarning)
>> so they ignore the warning, even if it occurs.
>>
>> Is there a way to reset whatever internal flag the
>> warnings module has that indicates that a warning has
>> already been issued once?
>>   
>>     
>
> Partially answering my own question:  in the test
> where I want the warning to occur, I could use a
> simplefilter to always issue deprecation warnings:
>
>   warnings.simplefilter('always', category=DeprecationWarning)
>
>   

Nope, that doesn't do what I expected.  Now I'll be quiet
until I have a better idea of how warnings *really*
work.

Warren


> Warren
>
>
>   
>> I see that the documentation for the warnings module
>> describes a 'catch_warnings' context manager, but
>> we need to be compatible with Python 2.4.  The 'with'
>> statement appears in 2.5.
>>
>> Warren
>>
>>
>> P.S. It looks like handling of DeprecationWarnings will
>> require a little more work with Python 2.7, where they
>> are ignored by default.
>>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>   
>>     
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>   



More information about the SciPy-Dev mailing list