[issue10228] Refleak run of test_dbm fails when several dbm modules are available

Ray.Allen report at bugs.python.org
Tue Feb 22 13:41:53 CET 2011


Ray.Allen <ysj.ray at gmail.com> added the comment:

It looks like because before the second time running of WhichDBTestCase.test_whichdb(), previous dumb files are not cleaned clearly, so the gdbm's open() doesn't create a new gdbm database but open an existing dumb database.

In fact during the working of #9523, I found this problem and fix it in the patch of #9523. Here I extract the fixing, it is simple:


cat patches/issue10228.diff 
Index: Lib/test/test_dbm.py
===================================================================
--- Lib/test/test_dbm.py	(revision 88499)
+++ Lib/test/test_dbm.py	(working copy)
@@ -123,7 +123,7 @@
             name = module.__name__
             if name == 'dbm.dumb':
                 continue   # whichdb can't support dbm.dumb
-            test.support.unlink(_fname)
+            delete_files()
             f = module.open(_fname, 'c')
             f.close()
             self.assertEqual(name, dbm.whichdb(_fname))

----------
nosy: +ysj.ray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10228>
_______________________________________


More information about the Python-bugs-list mailing list