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): ...@@ -74,6 +74,7 @@ class CacheTestBase(unittest.TestCase):
# CantGetRidOfMe is used by checkMinimizeTerminates. # CantGetRidOfMe is used by checkMinimizeTerminates.
make_trouble = True
class CantGetRidOfMe(MinPO): class CantGetRidOfMe(MinPO):
def __init__(self, value): def __init__(self, value):
MinPO.__init__(self, value) MinPO.__init__(self, value)
...@@ -83,6 +84,7 @@ class CantGetRidOfMe(MinPO): ...@@ -83,6 +84,7 @@ class CantGetRidOfMe(MinPO):
# Referencing an attribute of self causes self to be # Referencing an attribute of self causes self to be
# loaded into the cache again, which also resurrects # loaded into the cache again, which also resurrects
# self. # self.
if make_trouble:
self.an_attribute self.an_attribute
class DBMethods(CacheTestBase): class DBMethods(CacheTestBase):
...@@ -147,6 +149,10 @@ class DBMethods(CacheTestBase): ...@@ -147,6 +149,10 @@ class DBMethods(CacheTestBase):
self.testcase = testcase self.testcase = testcase
def run(self): def run(self):
global make_trouble
# Make CantGetRidOfMe.__del__ dangerous.
make_trouble = True
conn = self.testcase.conns[0] conn = self.testcase.conns[0]
r = conn.root() r = conn.root()
d = r[1] d = r[1]
...@@ -156,6 +162,12 @@ class DBMethods(CacheTestBase): ...@@ -156,6 +162,12 @@ class DBMethods(CacheTestBase):
self.testcase.db.cacheMinimize() 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 = Worker(self)
w.start() w.start()
w.join(30) 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