From d16797c5528769c6b6403a60f4ae167c325d84c6 Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Sat, 8 Apr 2017 18:25:59 -0400 Subject: [PATCH] make sure we close the db we open A test intentionally causes an exception to be raised and this was causing tearDown to fail on windows. --- src/ZODB/tests/testConfig.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ZODB/tests/testConfig.py b/src/ZODB/tests/testConfig.py index 1f22136a6..c709e66cd 100644 --- a/src/ZODB/tests/testConfig.py +++ b/src/ZODB/tests/testConfig.py @@ -33,13 +33,15 @@ def tearDown(self): def _test(self, s): db = self._opendb(s) - self.storage = db._storage - # Do something with the database to make sure it works - cn = db.open() - rt = cn.root() - rt["test"] = 1 - transaction.commit() - db.close() + try: + self.storage = db._storage + # Do something with the database to make sure it works + cn = db.open() + rt = cn.root() + rt["test"] = 1 + transaction.commit() + finally: + db.close() class ZODBConfigTest(ConfigTestBase):