mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Plug the last 657 referenceleaks in test_bsddb3: a circular reference
between a TestCase instance, the database it opened (or a cursor to a database) and a bound method as a registered database callback, and a lack of GC-handling in bsddb caused the TestCases to linger. Fix the test, for now, as backward compatibility makes adding GC to bsddb annoying.
This commit is contained in:
parent
b2820ae355
commit
318af47512
1 changed files with 5 additions and 0 deletions
|
|
@ -105,6 +105,7 @@ class AssociateErrorTestCase(unittest.TestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.env.close()
|
||||
self.env = None
|
||||
import glob
|
||||
files = glob.glob(os.path.join(self.homeDir, '*'))
|
||||
for file in files:
|
||||
|
|
@ -166,6 +167,7 @@ class AssociateTestCase(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
self.closeDB()
|
||||
self.env.close()
|
||||
self.env = None
|
||||
import glob
|
||||
files = glob.glob(os.path.join(self.homeDir, '*'))
|
||||
for file in files:
|
||||
|
|
@ -192,9 +194,12 @@ class AssociateTestCase(unittest.TestCase):
|
|||
def closeDB(self):
|
||||
if self.cur:
|
||||
self.cur.close()
|
||||
self.cur = None
|
||||
if self.secDB:
|
||||
self.secDB.close()
|
||||
self.secDB = None
|
||||
self.primary.close()
|
||||
self.primary = None
|
||||
|
||||
def getDB(self):
|
||||
return self.primary
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue