[testlib] deprecated the older api to access the repo.
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 27 Jun 2013 19:14:22 +0200
changeset 9124 d1d4b3669e41
parent 9123 c992811edec2
child 9125 9aaf8472bad0
[testlib] deprecated the older api to access the repo.
devtools/testlib.py
--- a/devtools/testlib.py	Thu Jun 27 19:09:23 2013 +0200
+++ b/devtools/testlib.py	Thu Jun 27 19:14:22 2013 +0200
@@ -273,7 +273,9 @@
         while self._open_access:
             self._open_access.pop().close()
 
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def set_cnx(self, cnx):
+        """"""
         # XXX we want to deprecate this
         assert getattr(cnx, '_session', None) is not None
         if cnx is self._admin_clt_cnx:
@@ -284,6 +286,7 @@
             self._current_clt_cnx = cnx
 
     @property
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def cnx(self):
         # XXX we want to deprecate this
         clt_cnx = self._current_clt_cnx
@@ -300,6 +303,7 @@
             self._cnxs.remove(cnx)
 
     @property
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def session(self):
         """return current server side session"""
         # XXX We want to use a srv_connection instead and deprecate this
@@ -315,14 +319,17 @@
         return session
 
     @property
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def websession(self):
         return self.session
 
     @property
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def adminsession(self):
         """return current server side session (using default manager account)"""
         return self._admin_session
 
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def login(self, login, **kwargs):
         """return a connection for the given login/password"""
         __ = kwargs.pop('autoclose', True) # not used anymore
@@ -337,6 +344,7 @@
         clt_cnx.__enter__()
         return TestCaseConnectionProxy(self, clt_cnx)
 
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def restore_connection(self):
         self._pop_custom_cnx()
 
@@ -374,6 +382,7 @@
     # db api ##################################################################
 
     @nocoverage
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def cursor(self, req=None):
         if req is not None:
             return req.cnx
@@ -381,6 +390,7 @@
             return self.cnx
 
     @nocoverage
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def execute(self, rql, args=None, eidkey=None, req=None):
         """executes <rql>, builds a resultset, and returns a couple (rset, req)
         where req is a FakeRequest
@@ -392,6 +402,7 @@
         return req.execute(unicode(rql), args)
 
     @nocoverage
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def commit(self):
         try:
             return self.cnx.commit()
@@ -399,6 +410,7 @@
             self.session.set_cnxset() # ensure cnxset still set after commit
 
     @nocoverage
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def rollback(self):
         try:
             self.cnx.rollback()
@@ -408,6 +420,7 @@
             self.session.set_cnxset() # ensure cnxset still set after commit
 
     requestcls = fake.FakeRequest
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def request(self, rollbackfirst=False, url=None, headers={}, **kwargs):
         """return a web ui request"""
         if rollbackfirst:
@@ -418,6 +431,7 @@
 
     # server side db api #######################################################
 
+    @deprecated('[4.0] explicitly use RepoAccess object in test instead')
     def sexecute(self, rql, args=None, eid_key=None):
         if eid_key is not None:
             warn('[3.8] eid_key is deprecated, you can safely remove this argument',