[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/tests/testCache.py
checkMinimizeTerminates: the nasty immortal objects the
Tim Peters
tim.one at comcast.net
Thu Jun 3 13:09:51 EDT 2004
Log message for revision 25232:
checkMinimizeTerminates: the nasty immortal objects the
worker thread creates could cause mysterious exceptions in
*later* tests (when running all the tests, they appeared
to come out of checkDetail, which runs right after
checkMinimizeTerminates). Changed the CantRidOfMe class
so that instances of the class *can* be gotten rid of,
keying off a new module bool. The checkMinimizeTerminates
worker thread uses this to defang the objects after the
body of the test has completed.
-=-
Modified: ZODB/trunk/src/ZODB/tests/testCache.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testCache.py 2004-06-03 15:11:27 UTC (rev 25231)
+++ ZODB/trunk/src/ZODB/tests/testCache.py 2004-06-03 17:09:51 UTC (rev 25232)
@@ -74,6 +74,7 @@
# CantGetRidOfMe is used by checkMinimizeTerminates.
+make_trouble = True
class CantGetRidOfMe(MinPO):
def __init__(self, value):
MinPO.__init__(self, value)
@@ -83,7 +84,8 @@
# Referencing an attribute of self causes self to be
# loaded into the cache again, which also resurrects
# self.
- self.an_attribute
+ if make_trouble:
+ self.an_attribute
class DBMethods(CacheTestBase):
@@ -147,6 +149,10 @@
self.testcase = testcase
def run(self):
+ global make_trouble
+ # Make CantGetRidOfMe.__del__ dangerous.
+ make_trouble = True
+
conn = self.testcase.conns[0]
r = conn.root()
d = r[1]
@@ -156,6 +162,12 @@
self.testcase.db.cacheMinimize()
+ # Defang the nasty objects. Else, because they're
+ # immortal now, they hang around and create trouble
+ # for subsequent tests.
+ make_trouble = False
+ self.testcase.db.cacheMinimize()
+
w = Worker(self)
w.start()
w.join(30)
More information about the Zodb-checkins
mailing list