Commit 32b3ba73 authored by Tim Peters's avatar Tim Peters

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.
parent a775a422
......@@ -74,6 +74,7 @@ class CacheTestBase(unittest.TestCase):
# CantGetRidOfMe is used by checkMinimizeTerminates.
make_trouble = True
class CantGetRidOfMe(MinPO):
def __init__(self, value):
MinPO.__init__(self, value)
......@@ -83,7 +84,8 @@ class CantGetRidOfMe(MinPO):
# 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 @@ class DBMethods(CacheTestBase):
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 @@ class DBMethods(CacheTestBase):
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment