Commit db6d6783 authored by Barry Warsaw's avatar Barry Warsaw

Changes to make the tests more robust under Windows.

tearDown(): Make sure any outstanding transactions are aborted so as
not to retain modified objects connected to closed databases.  Second,
call self._close() to free any resources.

_close(): Close the DB object, which in turn closes the underlying
storage.
parent aaeb1489
......@@ -22,7 +22,16 @@ class BaseFramework(unittest.TestCase):
self.tearDown()
raise
def _close(self):
self._db.close()
def tearDown(self):
# If the tests exited with any uncommitted objects, they'll blow up
# subsequent tests because the next transaction commit will try to
# commit those object. But they're tied to closed databases, so
# that's broken. Aborting the transaction now saves us the headache.
get_transaction().abort()
self._close()
for file in os.listdir(self._dbhome):
os.unlink(os.path.join(self._dbhome, file))
os.removedirs(self._dbhome)
......
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