My overall solution came from using the # autonaming facility:
(defmacro basic-transaction-fixtures
[& forms]
`(clojure.test/use-fixtures
:each
(fn [f#]
(mount.core/start
#'orca.config/env
#'orca.db.core/*db*)
(orca.db.test-util/with-transaction [orca.db.core/*db*]
(clojure.java.jdbc/db-set-rollback-only! orca.db.core/*db*)
(do ~@forms)
(f#)))))
As for the question of why use a macro here, my initial answer to that was “because I’ve not done macros before and this is a great opportunity to learn.” Also, though, I thought it was the most sensible way to insert code into a db-transaction while ensuring it wouldn’t leak into long-term DB garbage. I believe that such use of macros to extend/enhance test fixtures is pretty common, but I could be wrong.