diff --git a/test/metabase/test_setup.clj b/test/metabase/test_setup.clj index a5b2f8914c1f97530beed2eefc7790d68facc1f5..ce79b3578066f9daa68b022a828867a8a2ac617c 100644 --- a/test/metabase/test_setup.clj +++ b/test/metabase/test_setup.clj @@ -99,3 +99,17 @@ [] (log/info "Shutting down Metabase unit test runner") (core/stop-jetty!)) + +(defn call-with-test-scaffolding + "Runs `test-startup` and ensures `test-teardown` is always + called. This function is useful for running a test (or test + namespace) at the repl with the appropriate environment setup for + the test to pass." + [f] + (try + (test-startup) + (f) + (catch Exception e + (throw e)) + (finally + (test-teardown))))