Skip to content

Commit 042b1b8

Browse files
committed
Add thread info.
Add some information about the thread each test ran on. May want to move this to something not specific to parallelization, otherwise non-parallel tests won't have any thread info.
1 parent 6a55869 commit 042b1b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/kaocha/testable.clj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@
264264
(recur (conj result r) testables)))
265265
result))))
266266

267+
(defn current-thread-info []
268+
(let [thread (Thread/currentThread)]
269+
{:name (.getName thread)
270+
:id (.getId thread)
271+
:group-name (.getName (.getThreadGroup thread))}))
272+
267273
(defn run-testables-parallel
268274
"Run a collection of testables, returning a result collection."
269275
[testables test-plan]
@@ -278,7 +284,7 @@
278284
(contains? types (:kaocha.testable/type %)) (dissoc :parallel)
279285
(and (hierarchy/suite? %) (contains? suites (:kaocha.testable/desc %))) (dissoc :parallel)
280286
true (update :levels (fn [x] (if (nil? x) 1 (inc x)))))]
281-
(run-testable % test-plan))))
287+
(run-testable (assoc % ::thread (current-thread-info) ) test-plan))))
282288
testables)]
283289
(comment (loop [result [] ;(ArrayBlockingQueue. 1024)
284290
[test & testables] testables]
@@ -310,7 +316,7 @@
310316
(:kaocha.testable/id testable)
311317
(cons testable)))
312318

313-
(defn test-seq-with-skipped
319+
(defn test-seq-with-skipped
314320
[testable]
315321
"Create a seq of all tests, including any skipped tests.
316322

0 commit comments

Comments
 (0)