[TIP] @unittest.expectedFailure

Benjamin Peterson benjamin at python.org
Mon Mar 1 13:32:04 PST 2010


2010/3/1 Chris Withers <chris at simplistix.co.uk>:
> Benjamin Peterson wrote:
>>
>> 2010/2/21 Chris Withers <chris at simplistix.co.uk>:
>>>
>>> Hi All,
>>>
>>> Does a @unittest.expectedFailure'd test count as a skip if it fails?
>>> What if it doesn't fail?
>>
>> It's called an expected failure not a skip, but it's basically the
>> same thing if it fails. An unexpected success occurs if the test
>> works.
>
> An what happens when an unexpected success occurs?

See below.

>
>>> Asked differently: how can I find out, when running tests, how many
>>> expectedFailure's tests there were, how many actually failed, and how
>>> many
>>> didn't?
>>
>> Programmatically or on command line?
>
> Both :-)

With the unittest runner, X is printed for expected failures and u for
unexpected successes. TestResult.addUnexpectedSuccess/ExpectedFailure
are called for each.



-- 
Regards,
Benjamin



More information about the testing-in-python mailing list