diff -r 8ef162b039a0 -r 2508ba96fad2 cubicweb/devtools/testlib.py --- a/cubicweb/devtools/testlib.py Fri Apr 05 17:40:02 2019 +0200 +++ b/cubicweb/devtools/testlib.py Tue Apr 16 15:49:03 2019 +0200 @@ -479,10 +479,7 @@ reverse_primary_email=user) user.cw_clear_relation_cache('in_group', 'subject') if commit: - try: - req.commit() # req is a session - except AttributeError: - req.cnx.commit() + getattr(req, 'cnx', req).commit() return user # other utilities #########################################################