Skip to content

Commit

Permalink
Ensure fixtures run appropriately
Browse files Browse the repository at this point in the history
As noted in a leiningen issue[1], overriding test-var isn't an
appropriate filtering approach, as it doesn't stop fixtures from
running for the filtered-out tests. They pointed to a Clojure
issue[2] that added the test-vars fn, which runs the fixtures
only for the vars you pass in. However, they indicated later in
that thread that while they waited for that issue to be resolved
(which it is now), they would just remove the :test metadata from
the vars. I haven't looked to confirm which approach they took,
so not sure if I'm being consistent. The only drawback seems to
be the lack of support fo the :test-ns-hook feature that allows
you to control order. This doesn't seem like that great of a
feature anyway, so I'm not too bothered.

[1] technomancy/leiningen#1269
[2] http://dev.clojure.org/jira/browse/CLJ-866
  • Loading branch information
ajoberstar committed Jun 12, 2016
1 parent 3371e1e commit f482eea
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,10 @@

(defmethod listener-report :default [_] nil)

(defn filtering-test-var [real-test-var]
(fn [v]
(if (contains? *descs* v)
(real-test-var v))))

(defn execute-tests [^EngineDescriptor descriptor ^EngineExecutionListener listener]
(binding [*listener* listener
*descs* (descriptors descriptor)
*current-desc* (atom nil)
test/test-var (filtering-test-var test/test-var)
test/report listener-report]
(test/run-all-tests)))
(let [selected-vars (keys *descs*)]
(test/test-vars selected-vars))))

0 comments on commit f482eea

Please sign in to comment.