On Fri, Oct 8, 2010 at 6:46 PM, Ralf Gommers <span dir="ltr"><<a href="mailto:ralf.gommers@googlemail.com" target="_blank">ralf.gommers@googlemail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br><br><div class="gmail_quote"><div><div></div><div>On Fri, Oct 8, 2010 at 1:09 AM, Jonathan March <span dir="ltr"><<a href="mailto:jmarch@enthought.com" target="_blank">jmarch@enthought.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Wed, Oct 6, 2010 at 6:17 PM,  <<a href="mailto:josef.pktd@gmail.com" target="_blank">josef.pktd@gmail.com</a>> wrote:<br>
> On Wed, Oct 6, 2010 at 7:08 PM, Jonathan March <<a href="mailto:jmarch@enthought.com" target="_blank">jmarch@enthought.com</a>> wrote:<br>
>> It appears that the numpy testing decorators for skipping and for<br>
>> known failure should behave similarly to each other, at least from<br>
>> their descriptions here:<br>
>> <a href="http://projects.scipy.org/numpy/wiki/TestingGuidelines#known-failures-skipping-tests" target="_blank">http://projects.scipy.org/numpy/wiki/TestingGuidelines#known-failures-skipping-tests</a><br>
>><br>
>> Yet in the following example, run under nose, they behave quite differently:<br>
>><br>
>> ====<br>
>> from numpy.testing import  dec<br>
>><br>
>> @dec.knownfailureif( True, "known failure test message")<br>
>> def test_will_fail():<br>
>>    pass<br>
>><br>
>> @dec.skipif( True, "skip test message")<br>
>> def test_to_skip():<br>
>>    pass<br>
>> ====<br>
>><br>
>> The skipped test is marked as "S" as expected, but when the<br>
>> KnownFailureTest exception is raised, nose handles it as an error<br>
>> (marked "E" rather than "K" as expected, and printing the stack<br>
>> trace.)<br>
>><br>
>> It's also interesting that nose has a --no-skip option but no<br>
>> corresponding option for ignoring known failure decorators.<br>
>><br>
>> Why the discrepancy? Who is out of step with whom? This is with numpy<br>
>> 1.4.0 and nosetests 0.11.3<br>
><br>
> just as additional information<br>
><br>
> This only happens on the command line, with nosetests packagename<br>
> but not with the function, packagename.test()<br>
><br></blockquote></div></div><div><br>Knownfailure is a numpy-specific plugin, which needs to be loaded for tests decorated with @dec.knownfailureif to be marked as K instead of E. This plugin loading is done by the NoseTester class (defined in numpy/testing/nosetester.py) which is used when tests are run through numpy.test().<br>



<br>Using 'nosetests' on the command line skips this plugin loading, hence the error. Nose does have a "skip" plugin so that never gives an error.<br> <br></div><div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">




> Josef<br>
<br>
<br>
Numpy issue, nose issue, or user issue?<br></blockquote></div><div><br>User issue.<br></div></div></blockquote></div><br>Thank you, Ralf. Very clear. I've opened a ticket on the corresponding documentation:<br><a href="http://projects.scipy.org/numpy/ticket/1630">http://projects.scipy.org/numpy/ticket/1630</a><br>

<br>Jonathan<br>
<br>