【发布时间】:2016-12-06 16:02:46
【问题描述】:
我见过很多 clojure 项目默认禁用集成测试,方法是将此设置添加到 project.clj:
:test-selectors {:default (complement :integration)
:integration :integration}
但是,如果命名空间只包含集成测试,那么当我运行 lein test! 时,其中的固定装置仍会运行!
例如,如果我运行lein new app test 并将core_test.clj 的内容设为:
(defn fixture [f]
(println "Expensive setup fixture is running")
(f))
(use-fixtures :once fixture)
(deftest ^:integration a-test
(println "integration test running"))
然后,当我运行 lein test 时,我看到即使没有运行测试,夹具也在运行。
在 clojure 中处理这个问题的正确方法是什么?
【问题讨论】:
标签: clojure clojure.test clojure-testing