Unverified Kaydet (Commit) ffd72acc authored tarafından Miss Islington (bot)'s avatar Miss Islington (bot) Kaydeden (comit) GitHub

bpo-33752: Fix a file leak in test_dbm. (GH-7376)


With addCleanup() f.close() was executed after tearDown().
(cherry picked from commit 6592d7fe)
Co-authored-by: 's avatarSerhiy Storchaka <storchaka@gmail.com>
üst 631fe1fa
...@@ -75,10 +75,8 @@ class AnyDBMTestCase: ...@@ -75,10 +75,8 @@ class AnyDBMTestCase:
def test_anydbm_creation_n_file_exists_with_invalid_contents(self): def test_anydbm_creation_n_file_exists_with_invalid_contents(self):
# create an empty file # create an empty file
test.support.create_empty_file(_fname) test.support.create_empty_file(_fname)
with dbm.open(_fname, 'n') as f:
f = dbm.open(_fname, 'n') self.assertEqual(len(f), 0)
self.addCleanup(f.close)
self.assertEqual(len(f), 0)
def test_anydbm_modification(self): def test_anydbm_modification(self):
self.init_db() self.init_db()
......
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