From abab9574c0628df7a059a6f54accc2cb8cbc959f Mon Sep 17 00:00:00 2001 From: Artem Medeu Date: Mon, 17 Apr 2023 12:58:15 +0600 Subject: [PATCH] fix test conflicts --- test/malli/dev_err_test.clj | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/malli/dev_err_test.clj b/test/malli/dev_err_test.clj index 4b6cbbe85..ffdb7c41c 100644 --- a/test/malli/dev_err_test.clj +++ b/test/malli/dev_err_test.clj @@ -4,7 +4,6 @@ [malli.dev.pretty :as pretty])) (defn plus-err - {:malli/schema [:=> [:cat [:vector]] [:int {:max 6}]]} [x] (inc x)) (defn ->plus-err [] plus-err) @@ -16,8 +15,13 @@ (is (= 7 ((->plus-err) 6)))) (testing "instrumentation shema error when starting" - (is (thrown-with-msg? - Exception #"Schema error when insrumenting function: malli.dev-err-test/plus-err - :malli.core/child-error" - (md/start! {:ns *ns*}))) - (md/stop!)))) + ;; append metadata only during test to prevent conflicts with other tests + (alter-meta! #'plus-err #(assoc % :malli/schema [:=> [:cat [:vector]] [:int {:max 6}]])) + (try + (is (thrown-with-msg? + Exception #"Schema error when insrumenting function: malli.dev-err-test/plus-err - :malli.core/child-error" + (md/start! {:ns *ns*}))) + (catch Throwable _ + (md/stop!))) + (alter-meta! #'plus-err #(dissoc % :malli/schema)))))