how do i get rid of duplicate clojure test-is unit

2019-07-20 09:13发布

问题:

I have a little script

(use 
 :reload-all
 'com.example.package1
 'com.example.package2
 'com.example.package3
 'com.example.testlib)

(run-tests
 'com.example.package1
 'com.example.package2
 'com.example.package3)

that I use to quickly reload everything and fire off the unit tests.
trouble is that each time (deftest ... ) is evaluated as the files are read an additional test is created so after working hard all day each test is now being run 103 times, eek!

回答1:

There is a flag *load-tests* which determines the behaviour of deftest. (doc deftest) seems to implicate that setting this flag to false could solve your problem.