def teardown(self): if self.should_skip_test_setup(): return self.blob_db.close() if self.optimize_migrations: self.optimizer.__exit__(None, None, None) if self.skip_teardown_for_reuse_db: return # delete couch databases deleted_databases = [] for app, uri in self.apps: if uri in deleted_databases: continue app_label = app.split('.')[-1] db = loading.get_db(app_label) try: db.server.delete_db(db.dbname) deleted_databases.append(uri) log.info("deleted database %s for %s", db.dbname, app_label) except ResourceNotFound: log.info("database %s not found for %s! it was probably already deleted.", db.dbname, app_label) # HACK clean up leaked database connections from corehq.sql_db.connections import connection_manager connection_manager.dispose_all() super(HqdbContext, self).teardown()
def teardown(self): if self.should_skip_test_setup(): return self.blob_db.close() # delete couch databases deleted_databases = [] skipcount = 0 for app in self.apps: app_label = app.split('.')[-1] db = loading.get_db(app_label) if db.dbname in deleted_databases: skipcount += 1 continue try: db.server.delete_db(db.dbname) deleted_databases.append(db.dbname) log.info("deleted database %s for %s", db.dbname, app_label) except ResourceNotFound: log.info("database %s not found for %s! it was probably already deleted.", db.dbname, app_label) if skipcount: log.info("skipped deleting %s app databases that were already deleted", skipcount) # HACK clean up leaked database connections from corehq.sql_db.connections import connection_manager connection_manager.dispose_all() super(HqdbContext, self).teardown()
def teardown(self): if self.should_skip_test_setup(): return self.blob_db.close() if self.optimize_migrations: self.optimizer.__exit__(None, None, None) if self.skip_teardown_for_reuse_db: return # delete couch databases deleted_databases = [] for app, uri in self.apps: if uri in deleted_databases: continue app_label = app.split('.')[-1] db = loading.get_db(app_label) try: db.server.delete_db(db.dbname) deleted_databases.append(uri) log.info("deleted database %s for %s", db.dbname, app_label) except ResourceNotFound: log.info( "database %s not found for %s! it was probably already deleted.", db.dbname, app_label) # HACK clean up leaked database connections from corehq.sql_db.connections import connection_manager connection_manager.dispose_all() super(HqdbContext, self).teardown()
def run_db_tests(self, suite): print("Running {0} tests with database".format(suite.countTestCases())) old_config = self.setup_databases() result = self.run_suite(suite) from corehq.sql_db.connections import Session, connection_manager Session.remove() connection_manager.dispose_all() self.teardown_databases(old_config) return self.suite_result(suite, result)
def teardown(self): if self.should_skip_test_setup(): return self.blob_db.close() if self.skip_teardown_for_reuse_db: return self.delete_couch_databases() # HACK clean up leaked database connections from corehq.sql_db.connections import connection_manager connection_manager.dispose_all() super(HqdbContext, self).teardown()
def teardown(self): if self.should_skip_test_setup(): return self.blob_db.close() if self.skip_teardown_for_reuse_db: return self.delete_couch_databases() # HACK clean up leaked database connections from corehq.sql_db.connections import connection_manager connection_manager.dispose_all() # in case this was set before we want to remove it now self.runner.keepdb = False super(HqdbContext, self).teardown()
def teardown(self): if self.should_skip_test_setup(): return self.blob_db.close() if self.skip_teardown_for_reuse_db: return self.delete_couch_databases() # HACK clean up leaked database connections from corehq.sql_db.connections import connection_manager connection_manager.dispose_all() # in case this was set before we want to remove it now self.runner.keepdb = False # tear down in reverse order self.old_names = reversed(self.old_names) super(HqdbContext, self).teardown()