def test_rollback_on_exception(self):
    canary = mock.Mock()
    try:
        with testing.db.connect() as conn:
            event.listen(conn, 'rollback', canary)
            conn.execute(select(1))
            assert conn.in_transaction()
            raise Exception('some error')
        assert False
    except:
        pass
    eq_(canary.mock_calls, [mock.call(conn)])
def test_rollback_on_exception(self):
    canary = mock.Mock()
    try:
        with testing.db.connect() as conn:
            event.listen(conn, 'rollback', canary)
            conn.execute(select(1))
            assert conn.in_transaction()
            raise Exception('some error')
        assert False
    except:
        pass
    eq_(canary.mock_calls, [mock.call(conn)])