Can you turn off persistence via script?

I there some documentation somewhere on how item.persist() works?
I’m writing a test suite, and I want to create a temporary item, perform some actions related to it, and then remove it, but I’m getting some weird log entries now because rrd4j has persisted the item and is re-creating it. I gather there is a way in config files to specify which items are persisted, but I really need this script to be self-contained.

Is there a way in a script to turn off persistence?

No. The persistence services are a bit old fashioned, and decide what to persist at start up. There are no means to change dynamically.

In OH3, the rrd4j service is installed by default, persists everything it can by by default, restores everything by default.
You probably don’t want that? You can use rrd4j.persist to take control of what it does. Any “new” Items won’t be looked at unless you want that.

If you want your test Item to be persisted, that can be commanded on a each-time basis in rules.