[Zope3-dev] Re: Solved: Zope3 memory mystery

Marius Gedminas mgedmin at b4net.lt
Sun Feb 20 10:18:52 EST 2005


On Sat, Feb 19, 2005 at 11:34:51PM -0500, Tim Peters wrote:
> [Jim Fulton]
> > A unit test set up an event subscriber that logged events to a list and
> > never unsubscribed it.  I just checked in a fix.
> 
> Cool!  Congratulations.  Do you think it might be helpful to sketch
> the procedure you used to determine this?  I didn't have anything
> better in mind than eliminating half the unit tests at a time, doing a
> binary search to zero in on the culprit(s).

SchoolTool's test runner has a feature that helps you find ill-behaving
tests. You register a set of checker objects.  The startTest method of
each checker gets called before every test is run, the stopTest method
afterwards.  A checker can save the state of some global variable as an
instance attribute in startTest, and compare it in stopTest.  If a
test failed to restore the old state, the checker's stopTest will print
a warning that includes the test name.

We have checkers in SchoolTool that check for tests that leave behind
dirty ZODB transactions, tests that print to stdout/stderr, test that
leak libxml2 objects, tests that register a logger with Python's logging
and not restore it later.

http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/tests/checks.py?view=auto

Marius Gedminas
-- 
After having done some test using hi-tech istruments (moving my mouse
during a kernel build) [...]
	-- Davide Libenzi on lkml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20050220/dcdd7bbc/attachment.bin


More information about the Zope3-dev mailing list