Thank you - that worked brilliantly. I'm using a Java load testing
tool called The Grinder and it has an instrumented HTTP library that
is dependent on running within The Grinder. So I have clj-http for
developing my tests and then I can drop them into load testing and
substitute the Grinder using
Thanks BG. I wasn't aware of the with-redefs. Then Gaz's way is cool.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with
2011/12/1 Baishampayan Ghose b.gh...@gmail.com
I think you should look at the binding function -
http://clojuredocs.org/clojure_core/clojure.core/binding
In my tests, I am using this to run the same tests using two different
functions, which are supposed to do the same thing (using two
Roman wrote:
Is there a way to replace a function only in current thread?
Only if it's dynamic.
Consider passing the function -- or group of functions -- as an argument.
-S
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send
I have Clojure code which makes HTTP requests to a server. Depending
on the context, I want to swap out the underlying HTTP library code.
For example, I use an instrumented library in a testing context and a
different library in a REPL context where the instrumented library
will not work. These
what about just re-defing the function inside the tests to the
instrumented version?
something like:
(ns one.http)
(defn get [] ...)
(ns one.http-instrumented)
(defn get [] ...)
(ns one.test.blah)
(with-redefs [one.http/get one.http-instrumented/get]
...)
guess you could put the redefs into
I think you should look at the binding function -
http://clojuredocs.org/clojure_core/clojure.core/binding
In my tests, I am using this to run the same tests using two different
functions, which are supposed to do the same thing (using two different
methods, internally).
In your case though,
I think you should look at the binding function -
http://clojuredocs.org/clojure_core/clojure.core/binding
In my tests, I am using this to run the same tests using two different
functions, which are supposed to do the same thing (using two different
methods, internally).
In your case