devtools/testlib.py
changeset 10346 b926ff4ef4a8
parent 10335 88a4e4a60fce
child 10353 d9a1e7939ee6
equal deleted inserted replaced
10345:ef54ea75a642 10346:b926ff4ef4a8
   356 
   356 
   357     @property
   357     @property
   358     @deprecated('[3.19] explicitly use RepoAccess object in test instead')
   358     @deprecated('[3.19] explicitly use RepoAccess object in test instead')
   359     def session(self):
   359     def session(self):
   360         """return current server side session"""
   360         """return current server side session"""
   361         # XXX We want to use a srv_connection instead and deprecate this
       
   362         # property
       
   363         session = self._current_session
   361         session = self._current_session
   364         if session is None:
   362         if session is None:
   365             session = self._admin_session
   363             session = self._admin_session
   366             # bypassing all sanity to use the same repo cnx in the session
       
   367             #
       
   368             # we can't call set_cnx as the Connection is not managed by the
       
   369             # session.
       
   370             session._Session__threaddata.cnx = self._admin_clt_cnx._cnx
       
   371         else:
       
   372             session._Session__threaddata.cnx = self.cnx._cnx
       
   373         session.set_cnxset()
       
   374         return session
   364         return session
   375 
   365 
   376     @property
   366     @property
   377     @deprecated('[3.19] explicitly use RepoAccess object in test instead')
   367     @deprecated('[3.19] explicitly use RepoAccess object in test instead')
   378     def websession(self):
   368     def websession(self):
   540         if self._admin_clt_cnx is not None:
   530         if self._admin_clt_cnx is not None:
   541             if self._admin_clt_cnx._open:
   531             if self._admin_clt_cnx._open:
   542                 self._admin_clt_cnx.close()
   532                 self._admin_clt_cnx.close()
   543             self._admin_clt_cnx = None
   533             self._admin_clt_cnx = None
   544         if self._admin_session is not None:
   534         if self._admin_session is not None:
   545             if not self._admin_session.closed:
   535             self.repo.close(self._admin_session.sessionid)
   546                 self.repo.close(self._admin_session.sessionid)
       
   547             self._admin_session = None
   536             self._admin_session = None
   548         while self._cleanups:
   537         while self._cleanups:
   549             cleanup, args, kwargs = self._cleanups.pop(-1)
   538             cleanup, args, kwargs = self._cleanups.pop(-1)
   550             cleanup(*args, **kwargs)
   539             cleanup(*args, **kwargs)
   551         self.repo.turn_repo_off()
   540         self.repo.turn_repo_off()