bug or feature in (require ...)?

0 views
Skip to first unread message

Alex Ott

unread,
Dec 18, 2009, 1:43:03 PM12/18/09
to Clojure ML
Hello all

I found interesting behaviour of clojure when debugging why tests aren't
working when build incanter with maven...

In incanter there is following code:

(def test-names [:core-tests
:stats-tests
:io-tests
:charts-tests
:internal-tests
:chrono-test
:transformations-tests
:probability-tests
:information-theory-tests
:bayes-tests])

(def test-namespaces (map #(symbol (str "incanter." (name %))) test-names))

(defn run "Runs all defined tests" []
(println "Loading tests...")
(apply require :reload-all test-namespaces)
(apply run-tests test-namespaces))

that dynamically loads and executes set of tests. The problem is
if :reload-all option is used, then tests, defined in incanter.charts-tests
aren't working. But when i change it to :reload, then all works fine.

It seems, that tests, that are loaded after charts-tests, completely reload
libraries, discarding previously loaded incanter.chart library, that is
used only in charts-tests...

Question - this is feature of require? or this is a bug?

--
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/ http://xtalk.msk.su/~ott/
http://alexott-ru.blogspot.com/

Meikel Brandmeyer

unread,
Dec 19, 2009, 2:13:06 PM12/19/09
to clo...@googlegroups.com
Hi,

Am 18.12.2009 um 19:43 schrieb Alex Ott:

> Question - this is feature of require? or this is a bug?

The current require cannot handle this situation. You will have to reload all namespaces with :reload in the right order manually.

See here for more on this issue:
http://groups.google.com/group/clojure-dev/browse_thread/thread/b9d15561e8a3b5aa

Sincerely
Meikel

Reply all
Reply to author
Forward
0 new messages