On Fri, 2012-03-16 at 13:59 +0100, Petr Viktorin wrote:
> On 03/15/2012 10:36 PM, Rob Crittenden wrote:
> > Petr Viktorin wrote:
> >> Can you spot the bug in this test code?
> >>
> >> try:
> >> do_invalid_operation()
> >> except ExpectedError:
> >> pass
> >>
> >>
> >> Our test suite had several of those.
> >> Nose provides nice tools, `raises` (a decorator) and `assert_raises` (a
> >> context manager) that make checking expected exceptions a lot easier and
> >> less error-prone. This patch makes our tests use them.
> >>
> >> If you didn't catch it, the error is that the test will pass when no
> >> exception is raised. Some of our tests handled that by adding an `else:
> >> assert False`, or an `assert False` at the end of the try block.
> >> For consistency, the patch switches these correct ones to
> >> raises/assert_raises as well.
> >>
> >> I've also uncovered and fixed a few test bugs that were hidden by this.
> >>
> >
> >
> > test_1a_automountmap_add_indirect() was failing, checking for the wrong
> > exception.
> 
> Silly me. Thanks for catching this.
> 
> > I also suggest using @raises for clarity in another spot. Here are my
> > suggested changes:
> >
> 
> Attaching updated patch.
> 

ACK. Pushed to master, ipa-2-2.

Martin

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to