From f482eeaac72187bc71174d41e67b257213284f1d Mon Sep 17 00:00:00 2001 From: Andrew Oberstar Date: Sun, 12 Jun 2016 18:35:31 -0500 Subject: [PATCH] Ensure fixtures run appropriately 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] https://github.com/technomancy/leiningen/issues/1269 [2] http://dev.clojure.org/jira/browse/CLJ-866 --- .../ajoberstar/jupiter/engine/clojure_test/execution.clj | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/jupiter-engine-clojure.test/src/main/resources/org/ajoberstar/jupiter/engine/clojure_test/execution.clj b/jupiter-engine-clojure.test/src/main/resources/org/ajoberstar/jupiter/engine/clojure_test/execution.clj index 48e132a..d83c93d 100644 --- a/jupiter-engine-clojure.test/src/main/resources/org/ajoberstar/jupiter/engine/clojure_test/execution.clj +++ b/jupiter-engine-clojure.test/src/main/resources/org/ajoberstar/jupiter/engine/clojure_test/execution.clj @@ -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))))