cubicweb #2276662 Improve self.login and self.assertRaises CM interaction in test cases [waiting feedback]

In CubicWebTC the context managers returned by self.login and self.assertRaises do not play well (or at least intuitively) with each other. We would like to write

with self.login(user) as cur:
    ...
    with self.assertRaises(...) as cm:
        ...
    self.assertXXX( cm.exception, ...)
    .... # other tests

But we can't because the expected exception will let the connection in the uncommitable state, which will raise a QueryError('connection needs to be rollbacked'). A solution is to add a `self.rollback() just before the other tests.

This is no bug but a very common error in writting tests. We propose to enhance the self.login CM to issue a specific message in this case.

prioritynormal
typeenhancement
done in<not specified>
load0.200
load left0.200
closed by<not specified>