Expected failure not failing when assertion succeeds
Martin (gzlist)
gzlist at googlemail.com
Tue Feb 16 21:19:48 GMT 2010
On 16/02/2010, John Arbash Meinel <john at arbash-meinel.com> wrote:
>
> Specifically I would expect this test to fail:
>
> def test_expected_failure(self):
> self.expectFailure("expect failure but find success",
> self.assertEqual, 1, 1)
>
> However this succeeds without complaint.
Okay, now I'm just confused. That's what I thought as well, but after
reading the docstring for expectFailure in testtools.testcase decided
I must have got it backwards. As the output it gives is near useless
either way (rather than a nice traceback of the stack context in the
test as before) I've no idea what's right.
> On the other hand, shouldn't an unexpected success default to being
> treated as a failure (addFailure() rather than addSuccess)?
I think that could be argued about, but it certainly used to.
Martin
More information about the bazaar
mailing list