def METHOD_NAME(database, monkeypatch):
    """Provide database access and ensure changes do not persist."""
    # Prevent database/session modifications
    monkeypatch.setattr(database.session, 'commit', database.session.flush)
    monkeypatch.setattr(database.session, 'remove', lambda: None)
    rollback = database.session.rollback
    # disable rollback in case we use the test client where RHs do a rollback
    # XXX maybe we should do nested transactions?
    monkeypatch.setattr(database.session, 'rollback', lambda: None)
    @contextmanager
    def _tmp_session():
        _old_commit = database.session.commit
        database.session.commit = lambda: None
        yield database.session
        database.session.commit = _old_commit
    monkeypatch.setattr(database, 'tmp_session', _tmp_session, lambda: None)
    yield database
    rollback()
    database.session.remove()