leiningen/test_projects/sample_no_aot/test/selectors.clj
Gary Fredericks 08eaf70781 #1269: Skip tests differently when using :test-selectors
The old method skipped tests by adding a hook to
clojure.test/test-var, the problem being that :each fixtures
associated with the test have already run at that point, which is
unideal.

This change skips test by removing their :test metadata before running
the tests at all, which causes clojure.test to not see it as a test.

We use ns-interns to enumerate the vars, the same way clojure.test
does.
2013-07-31 23:29:19 -05:00

27 lines
633 B
Clojure

(ns selectors
(:use [clojure.test]
[clojure.java.io]))
(defn record-ran [t]
(let [file-name (format "%s/lein-test-ran"
(System/getProperty "java.io.tmpdir"))]
(with-open [w (writer file-name :append true)]
(.write w (str t "\n")))))
(use-fixtures :each (fn [t] (record-ran :fixture) (t)))
(deftest ^{:integration true} integration-test
(record-ran :integration)
(is true))
(deftest regular
(record-ran :regular)
(is true))
(deftest ^{:custom false} not-custom
(record-ran :not-custom)
(is true))
(deftest ^{:int2 true} integration-2
(record-ran :int2)
(is true))