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
|
(ns babashka.run-all-libtests
|
||||||
(:require [babashka.classpath :as cp :refer [add-classpath]]
|
(:require
|
||||||
[babashka.core :refer [windows?]]
|
[babashka.classpath :as cp :refer [add-classpath]]
|
||||||
[babashka.fs :as fs]
|
[babashka.core :refer [windows?]]
|
||||||
[clojure.edn :as edn]
|
[babashka.fs :as fs]
|
||||||
[clojure.java.io :as io]
|
[clojure.edn :as edn]
|
||||||
[clojure.test :as t :refer [*report-counters*]]
|
[clojure.java.io :as io]
|
||||||
[clojure.string :as str]))
|
[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*]
|
(when-let [rc *report-counters*]
|
||||||
(let [{:keys [:fail :error]} @rc]
|
(let [{:keys [:fail :error]} @rc]
|
||||||
(when (and (= "true" (System/getenv "BABASHKA_FAIL_FAST"))
|
(when (and (= "true" (System/getenv "BABASHKA_FAIL_FAST"))
|
||||||
|
|
@ -35,17 +39,19 @@
|
||||||
(defn test-namespaces [& namespaces]
|
(defn test-namespaces [& namespaces]
|
||||||
(let [namespaces (seq (filter test-namespace? namespaces))]
|
(let [namespaces (seq (filter test-namespace? namespaces))]
|
||||||
(when (seq namespaces)
|
(when (seq namespaces)
|
||||||
(let [no-orch-namespaces (remove #(str/starts-with? (str %) "orchestra") namespaces)
|
(let [namespaces 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)]
|
|
||||||
(doseq [n namespaces]
|
(doseq [n namespaces]
|
||||||
(require n)
|
(let [orchestra? (str/starts-with? (str n) "orchestra")]
|
||||||
(filter-vars! (find-ns n) #(-> % meta ((some-fn :skip-bb
|
(if orchestra?
|
||||||
:test-check-slow)) not))
|
nil ;; (alter-var-root #'st/spec-checking-fn (constantly ot/spec-checking-fn))
|
||||||
(let [m (apply t/run-tests [n])]
|
(alter-var-root #'st/spec-checking-fn (constantly orig-spec-checking-fn)))
|
||||||
(swap! status (fn [status]
|
(when-not orchestra?
|
||||||
(merge-with + status (dissoc m :type))))))))))
|
(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
|
;; Standard test-runner for libtests
|
||||||
(let [lib-tests (edn/read-string (slurp (io/resource "bb-tested-libs.edn")))
|
(let [lib-tests (edn/read-string (slurp (io/resource "bb-tested-libs.edn")))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue