This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Refleak run of test_dbm fails when several dbm modules are available
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, giampaolo.rodola, orsenthil, pitrou, ysj.ray
Priority: normal Keywords:

Created on 2010-10-29 10:11 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg119877 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-29 10:11
This is only when several dbm modules are compiled in (e.g. "gnu" and "dumb"):

$ ./python -m test.regrtest -R 3:2 test_dbm
[1/1] test_dbm
beginning 5 repetitions
12345
test test_dbm failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/deallocwarn/Lib/test/test_dbm.py", line 129, in test_whichdb
    self.assertEqual(name, dbm.whichdb(_fname))
AssertionError: 'dbm.gnu' != 'dbm.dumb'
- dbm.gnu
+ dbm.dumb
msg120583 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-06 05:38
A quick look makes me think the bug is in the test, not the code.
msg129064 - (view) Author: ysj.ray (ysj.ray) Date: 2011-02-22 12:41
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))
msg129497 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-02-26 03:44
Fixed in revision 88631
msg129499 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 06:31
Can you backport to 3.2?
msg129505 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-02-26 07:11
Done in r88634.
History
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54437
2011-02-26 07:11:50orsenthilsetnosy: orsenthil, pitrou, giampaolo.rodola, eric.araujo, ysj.ray
messages: + msg129505
2011-02-26 06:31:53pitrousetnosy: orsenthil, pitrou, giampaolo.rodola, eric.araujo, ysj.ray
messages: + msg129499
2011-02-26 03:44:54orsenthilsetstatus: open -> closed

nosy: + orsenthil
messages: + msg129497

resolution: fixed
stage: needs patch -> resolved
2011-02-22 12:41:53ysj.raysetnosy: + ysj.ray
messages: + msg129064
2010-11-08 11:52:56michael.foordsetnosy: - michael.foord
2010-11-06 05:38:30eric.araujosetnosy: + giampaolo.rodola, eric.araujo, michael.foord
messages: + msg120583
2010-10-29 10:11:51pitroucreate