diff --git a/.dir-locals.el b/.dir-locals.el index d0919155e35ddeef8fc83c1052fc4125f7de22b3..be1ae3c9207d8a6080bf2d6d7ae072e6b22c9ead 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -40,7 +40,7 @@ (qp.streaming/streaming-response 1) (prop/for-all 1) (tools.macro/macrolet '(1 (:defn)))))) - (cider-clojure-cli-aliases . "dev:drivers:drivers-dev:ee:ee-dev:build:user") + (cider-clojure-cli-aliases . "dev:drivers:drivers-dev:ee:ee-dev:user") (clojure-indent-style . always-align) ;; if you're using clj-refactor (highly recommended!) (cljr-favor-prefix-notation . nil) diff --git a/test/metabase/test_runner.clj b/test/metabase/test_runner.clj index 16f921a5708f900d278573c8c8e4105777cd872f..f601d4da8ca4db2e1e7049eaf597a92e71aac57c 100644 --- a/test/metabase/test_runner.clj +++ b/test/metabase/test_runner.clj @@ -16,7 +16,6 @@ [metabase.test-runner.parallel :as parallel] [metabase.test.data.env :as tx.env] metabase.test.redefs - [metabase.util :as u] [pjstadig.humane-test-output :as humane-test-output])) ;; initialize Humane Test Output if it's not already initialized. @@ -70,13 +69,18 @@ ;; a test namespace or individual test (defmethod find-tests clojure.lang.Symbol [symb] - (if (namespace symb) - ;; a actual test var e.g. `metabase.whatever-test/my-test` - [symb] - ;; a namespace e.g. `metabase.whatever-test` - (binding [init/*test-namespace-being-loaded* symb] - (require symb) - (eftest.runner/find-tests symb)))) + (letfn [(load-test-namespace [ns-symb] + (binding [init/*test-namespace-being-loaded* ns-symb] + (require ns-symb)))] + (if-let [symbol-namespace (some-> (namespace symb) symbol)] + ;; a actual test var e.g. `metabase.whatever-test/my-test` + (do + (load-test-namespace symbol-namespace) + [(resolve symb)]) + ;; a namespace e.g. `metabase.whatever-test` + (do + (load-test-namespace symb) + (eftest.runner/find-tests symb))))) ;; default -- look in all dirs on the classpath (defmethod find-tests nil @@ -86,7 +90,7 @@ (defn tests [{:keys [only]}] (when only (println "Running tests in" (pr-str only))) - (let [tests (u/profile "Find tests" (find-tests only))] + (let [tests (find-tests only)] (println "Running" (count tests) "tests") tests)) @@ -117,22 +121,25 @@ "Run `test-vars` with `options`, which are passed directly to [[eftest.runner/run-tests]]. ;; run tests in a single namespace - (run (find-tests 'metabase.bad-test) nil) + (run (find-tests 'metabase.bad-test)) ;; run tests in a directory - (run (find-tests \"test/metabase/query_processor_test\") nil)" - [test-vars options] - ;; don't randomize test order for now please, thanks anyway - (with-redefs [eftest.runner/deterministic-shuffle (fn [_ test-vars] test-vars)] - (eftest.runner/run-tests - test-vars - (merge - {:capture-output? false - ;; parallel tests disabled for the time being -- some tests randomly fail if the data warehouse connection pool - ;; gets nuked by a different thread. Once we fix that we can re-enable parallel tests. - :multithread? false #_:vars - :report (reporter)} - options)))) + (run (find-tests \"test/metabase/query_processor_test\"))" + ([test-vars] + (run test-vars nil)) + + ([test-vars options] + ;; don't randomize test order for now please, thanks anyway + (with-redefs [eftest.runner/deterministic-shuffle (fn [_ test-vars] test-vars)] + (eftest.runner/run-tests + test-vars + (merge + {:capture-output? false + ;; parallel tests disabled for the time being -- some tests randomly fail if the data warehouse connection pool + ;; gets nuked by a different thread. Once we fix that we can re-enable parallel tests. + :multithread? false #_:vars + :report (reporter)} + options))))) ;;;; `clojure -X` entrypoint diff --git a/test/metabase/test_runner/junit/write.clj b/test/metabase/test_runner/junit/write.clj index bfcf2e65403ea40503c90d42c678b549a3066628..940ca3137064b237c87ac6f71f0c00236a25003e 100644 --- a/test/metabase/test_runner/junit/write.clj +++ b/test/metabase/test_runner/junit/write.clj @@ -42,9 +42,9 @@ (defn- print-result-description [{:keys [file line message testing-contexts], :as result}] (println (format "%s:%d" file line)) (doseq [s (reverse testing-contexts)] - (println (str/trim (escape-unprintable-characters s)))) + (println (str/trim (decolorize-and-escape s)))) (when message - (println (escape-unprintable-characters message)))) + (println (decolorize-and-escape message)))) (defn- print-expected [expected actual] (p/rprint "expected: ")