Havvy
Havvy

Reputation: 1511

Removing defined tests in Clojure REPL

In Clojure, I have decided to move from writing :test metadata elements to using deftest. To see that I have written the deftest correctly, I try reloading and running the tests with a reload in the REPL.

While I don't care about duplicate tests per se, when I remove a test from the source, I would like it removed when I reload the source. Clearing the REPL doesn't remove the tests.

So, How many I remove tests defined via deftest from the Clojure REPL

Upvotes: 8

Views: 1009

Answers (2)

Stuart Dabbs Halloway
Stuart Dabbs Halloway

Reputation: 1666

clojure.test finds test vars by reflecting on namespaces, so you can use ns-unmap. For full details, see my earlier answer to a similar question

Upvotes: 8

Joost Diepenmaat
Joost Diepenmaat

Reputation: 17773

I don't think you can remove vars one-by-one in clojure (I may be wrong; it seems like a strange oversight if that's true). The easiest way to get rid of old definitions is probably to use remove-ns to get rid of the namespace and then re-evaluate the file / namespace / definitions.

Upvotes: 0

Related Questions