    (run-tests env (env/get-test-namespaces)))
   ([env namespaces]
    {:pre [(set? namespaces)]}
-   (-> (prepare-test-run env)
-       (into (->> (env/get-test-vars)
-                  (filter #(contains? namespaces (-> % meta :ns)))
-                  (test-vars-grouped-block)))
-       (finish-test-run)
-       (ct/run-block))))
+   (let [vars (->> (env/get-test-vars)
+                   (filter #(contains? namespaces (-> % meta :ns))))]
+     (-> (prepare-test-run env vars)
+         (into (test-vars-grouped-block vars))
+         (finish-test-run)
+         (ct/run-block)))))
 
 (defn run-all-tests
   "Runs all tests in all namespaces; prints results.

           (ct/update-current-env! [:each-fixtures] assoc test-ns fix)))

       ;; just in case report-fn wants to know when things starts
       (ct/report {:type :begin-run-tests}))]))

(defn finish-test-run [block]
  {:pre [(vector? block)]}

  "tests all vars grouped by namespace, expects seq of test vars, can be obtained from env"
  ([test-vars]
   (run-test-vars (ct/empty-env) test-vars))
  ([env vars]
   (-> (prepare-test-run env vars)
       (into (test-vars-grouped-block vars))
       (finish-test-run)
       (ct/run-block))))

