Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Hooked clojure.test report function should pass invocation through to original fn #914

Merged
merged 1 commit into from

2 participants

@senior

Currently Leiningen is intercepting the call to report, not letting it pass through to the function it's hooking. I have a custom report function that worked under lein 1 but never gets called in lein 2.

Couldn't think of a great way to test it, other than just adding the multi-method and checking that it's being called.

@technomancy
Owner

Good call; thanks. I hate the fact that we have to monkeypatch this, so anything we can do to play nicely is appreciated.

@technomancy technomancy merged commit 3d1aac4 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 10, 2013
  1. @senior

    changed leiningen/test to allow the call into the clojure.test report to

    senior authored
    pass through the hook to  the original multimethod
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +2 −1  src/leiningen/test.clj
  2. +10 −0 test/leiningen/test/test.clj
View
3  src/leiningen/test.clj
@@ -69,7 +69,8 @@
first meta :ns ns-name)))
(if (= :begin-test-ns (:type m#))
(clojure.test/with-test-out
- (println "\nlein test" (ns-name (:ns m#))))
+ (println "\nlein test" (ns-name (:ns m#)))
+ (apply report# m# args#))
(apply report# m# args#))))
summary# (binding [clojure.test/*test-out* *out*]
(apply ~'clojure.test/run-tests selected-namespaces#))]
View
10 test/leiningen/test/test.clj
@@ -44,3 +44,13 @@
(deftest test-only-selector
(test sample-no-aot-project ":only" "selectors/regular")
(is (= (ran?) #{:regular})))
+
+(def called? (atom false))
+
+(defmethod clojure.test/report :begin-test-ns [_]
+ (reset! called? true))
+
+(deftest test-report-call-through
+ (is (true? @called?))
+ (reset! called? false))
+
Something went wrong with that request. Please try again.