@testing.requires.savepoints
def test_savepoint_six(self):
    users = self.tables.users
    with testing.db.begin() as conn:
        conn.execute(users.insert(), {'user_id': 1, 'user_name': 'name'})
        sp1 = conn.begin_nested()
        conn.execute(users.insert(), {'user_id': 2, 'user_name': 'name2'})
        assert (conn._nested_transaction is sp1)
        sp2 = conn.begin_nested()
        conn.execute(users.insert(), {'user_id': 3, 'user_name': 'name3'})
        assert (conn._nested_transaction is sp2)
        sp2.commit()
        assert (conn._nested_transaction is sp1)
        sp1.rollback()
        assert (conn._nested_transaction is None)
        assert conn.in_transaction()
    with testing.db.connect() as conn:
        eq_(conn.scalar(select(func.count(1)).select_from(users)), 1)
@testing.requires.savepoints
def test_savepoint_six(self):
    users = self.tables.users
    with testing.db.begin() as conn:
        conn.execute(users.insert(), {'user_id': 1, 'user_name': 'name'})
        sp1 = conn.begin_nested()
        conn.execute(users.insert(), {'user_id': 2, 'user_name': 'name2'})
        assert (conn._nested_transaction is sp1)
        sp2 = conn.begin_nested()
        conn.execute(users.insert(), {'user_id': 3, 'user_name': 'name3'})
        assert (conn._nested_transaction is sp2)
        sp2.commit()
        assert (conn._nested_transaction is sp1)
        sp1.rollback()
        assert (conn._nested_transaction is None)
        assert conn.in_transaction()
    with testing.db.connect() as conn:
        eq_(conn.scalar(select(func.count(1)).select_from(users)), 1)