← Back to team overview

launchpad-dev team mailing list archive

New feature in Launchpad TestCase base class

 

Hi All,

In my continued mission to make things easier to test, I've added a new 
feature to the base TestCase class in lp.testing (this makes it in 
TestCaseWithFactory too).

r9327 of db-devel (will be rolled out tonight) contains this change.

The test case class now has an "oopses" attribute.  This is a list that gets 
any oops generated as part of the test appended as it is generated.

This gives any test a deterministic way to determine if any oopses were 
generated.

Tim

-- the magic

The error reporting utility now notifies listeners when a new oops is generated 
using an IErrorReportEvent (which is an object event).

The setUp method of the test case adds a listener, and adds the cleanup to 
remove the listener after tearDown.

This uses a Fixture that jml wrote a while ago for the scanner (which has 
since been removed).  The fixture code was moved to lp.testing.fixture.  If you 
have a need to use something in your tests that has a setUp and tearDown, you 
can define a fixture, and use the TestCase method installFixture.



Follow ups