Commit 92516cc4 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Destroy test database after test execution

Pithos uses a pool for the backend objects.
Pooled backend objects override the default close behavior
and return the object to the pool instead.
Therefore, django was unable to destroy the database
since there were active connections.
Therefore, we force the pool to shutdown before
the django attempts to destroy it.
parent 55388042
......@@ -144,6 +144,12 @@ class PithosTestSuiteRunner(DjangoTestSuiteRunner):
return old_names, mirrors
def teardown_databases(self, old_config, **kwargs):
from pithos.api.util import _pithos_backend_pool
super(PithosTestSuiteRunner, self).teardown_databases(old_config,
class PithosAPITest(TestCase):
def setUp(self):
......@@ -64,6 +64,7 @@ class DBWrapper(object):
def close(self):
self.conn = None
def execute(self):
self.trans = self.conn.begin()
......@@ -151,6 +151,14 @@ class PithosBackendPool(ObjectPool):
backend.messages = []
return False
def shutdown(self):
while True:
backend = self.pool_get(create=False)
if backend is None:
def _pooled_backend_close(backend):
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