Fix tests
This commit is contained in:
parent
80a8ee1b7e
commit
2b3e7df2e9
1 changed files with 24 additions and 18 deletions
|
|
@ -1,13 +1,17 @@
|
|||
(ns babashka.run-all-libtests
|
||||
(:require [babashka.classpath :as cp :refer [add-classpath]]
|
||||
[babashka.core :refer [windows?]]
|
||||
[babashka.fs :as fs]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.test :as t :refer [*report-counters*]]
|
||||
[clojure.string :as str]))
|
||||
(:require
|
||||
[babashka.classpath :as cp :refer [add-classpath]]
|
||||
[babashka.core :refer [windows?]]
|
||||
[babashka.fs :as fs]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.spec.test.alpha :as st]
|
||||
[clojure.string :as str]
|
||||
[clojure.test :as t :refer [*report-counters*]]))
|
||||
|
||||
(defmethod clojure.test/report :end-test-var [_m]
|
||||
(def orig-spec-checking-fn @#'st/spec-checking-fn)
|
||||
|
||||
(defmethod t/report :end-test-var [_m]
|
||||
(when-let [rc *report-counters*]
|
||||
(let [{:keys [:fail :error]} @rc]
|
||||
(when (and (= "true" (System/getenv "BABASHKA_FAIL_FAST"))
|
||||
|
|
@ -35,17 +39,19 @@
|
|||
(defn test-namespaces [& namespaces]
|
||||
(let [namespaces (seq (filter test-namespace? namespaces))]
|
||||
(when (seq namespaces)
|
||||
(let [no-orch-namespaces (remove #(str/starts-with? (str %) "orchestra") namespaces)
|
||||
;; somehow orchestra screws up other tests, so we run that last
|
||||
orch-namespaces (filter #(str/starts-with? (str %) "orchestra") namespaces)
|
||||
namespaces (concat no-orch-namespaces orch-namespaces)]
|
||||
(let [namespaces namespaces]
|
||||
(doseq [n namespaces]
|
||||
(require n)
|
||||
(filter-vars! (find-ns n) #(-> % meta ((some-fn :skip-bb
|
||||
:test-check-slow)) not))
|
||||
(let [m (apply t/run-tests [n])]
|
||||
(swap! status (fn [status]
|
||||
(merge-with + status (dissoc m :type))))))))))
|
||||
(let [orchestra? (str/starts-with? (str n) "orchestra")]
|
||||
(if orchestra?
|
||||
nil ;; (alter-var-root #'st/spec-checking-fn (constantly ot/spec-checking-fn))
|
||||
(alter-var-root #'st/spec-checking-fn (constantly orig-spec-checking-fn)))
|
||||
(when-not orchestra?
|
||||
(require n)
|
||||
(filter-vars! (find-ns n) #(-> % meta ((some-fn :skip-bb
|
||||
:test-check-slow)) not))
|
||||
(let [m (apply t/run-tests [n])]
|
||||
(swap! status (fn [status]
|
||||
(merge-with + status (dissoc m :type))))))))))))
|
||||
|
||||
;; Standard test-runner for libtests
|
||||
(let [lib-tests (edn/read-string (slurp (io/resource "bb-tested-libs.edn")))
|
||||
|
|
|
|||
Loading…
Reference in a new issue