devtools/testlib.py
branchstable
changeset 5778 1a4ac9e2ce63
parent 5751 1e5ef464cade
child 5783 c5ff8cd74758
equal deleted inserted replaced
5777:941038164cf5 5778:1a4ac9e2ce63
   216         initialized, we simply reset connections and repository caches.
   216         initialized, we simply reset connections and repository caches.
   217         """
   217         """
   218         if not 'repo' in cls.__dict__:
   218         if not 'repo' in cls.__dict__:
   219             cls._build_repo()
   219             cls._build_repo()
   220         else:
   220         else:
   221             cls.cnx.rollback()
   221             try:
       
   222                 cls.cnx.rollback()
       
   223             except:
       
   224                 pass
   222             cls._refresh_repo()
   225             cls._refresh_repo()
   223 
   226 
   224     @classmethod
   227     @classmethod
   225     def _build_repo(cls):
   228     def _build_repo(cls):
   226         cls.repo, cls.cnx = devtools.init_test_database(config=cls.config)
   229         cls.repo, cls.cnx = devtools.init_test_database(config=cls.config)
   278         self.setup_database()
   281         self.setup_database()
   279         self.commit()
   282         self.commit()
   280         MAILBOX[:] = [] # reset mailbox
   283         MAILBOX[:] = [] # reset mailbox
   281 
   284 
   282     def tearDown(self):
   285     def tearDown(self):
       
   286         self.cnx.rollback()
   283         for cnx in self._cnxs:
   287         for cnx in self._cnxs:
   284             if not cnx._closed:
   288             if not cnx._closed:
   285                 cnx.close()
   289                 cnx.close()
   286 
   290 
   287     def setup_database(self):
   291     def setup_database(self):