# HG changeset patch # User Julien Cristau # Date 1389717002 -3600 # Node ID 53974a06d646d4cab89db6c961bdf76eefcffa0f # Parent ae97167956b1465bd7c02f3b44d37c7d1ebffc23 [devtools] make CubicWebTC.login as admin undo previous logins Fixes things when login is not used as a context manager. diff -r ae97167956b1 -r 53974a06d646 devtools/testlib.py --- a/devtools/testlib.py Tue Jan 14 17:30:13 2014 +0100 +++ b/devtools/testlib.py Tue Jan 14 17:30:02 2014 +0100 @@ -337,8 +337,9 @@ """return a connection for the given login/password""" __ = kwargs.pop('autoclose', True) # not used anymore if login == self.admlogin: - # definitly don't want autoclose when used as a context manager - clt_cnx = repoapi.ClientConnection(self._admin_session) + # undo any previous login, if we're not used as a context manager + self.restore_connection() + return self.cnx else: if not kwargs: kwargs['password'] = str(login)