Re: overrding function from other namespace

2010-03-20 Thread Martin Hauner
Hi, yes, better than my solution. :) Wrapping the with-bindings around the run-tests I can drop the namespace switch. (with-bindings {#'clojure.contrib.mock/report-problem #'my-report- problem} (run-tests)) The only issue left is that when running the test with leiningen ("lein test") I don't

Re: overrding function from other namespace

2010-03-20 Thread Martin Hauner
Hi Kevin, On 20 Mrz., 00:34, Kevin Downey wrote: > why are you def'ing your functions in the mock namespace? why are you > juggling namespaces at all? Because clojure.contrib.mock says so. The only way that worked for me was switching the namespace. Without switching the namespace I get: Name c

Re: overrding function from other namespace

2010-03-19 Thread ataggart
I'd imagine you should be using with-bindings: user=> (ns foo) nil foo=> (defn bar [x] (inc x)) #'foo/bar foo=> (ns user) nil user=> (foo/bar 5) 6 user=> (with-bindings {#'foo/bar #(dec %)} (foo/bar 5)) 4 On Mar 17, 3:12 pm, Martin Hauner wrote: > Hi, > > I trying to use clojure.contrib.mock. I

Re: overrding function from other namespace

2010-03-19 Thread Kevin Downey
why are you def'ing your functions in the mock namespace? why are you juggling namespaces at all? On Wed, Mar 17, 2010 at 3:12 PM, Martin Hauner wrote: > Hi, > > I trying to use clojure.contrib.mock. It says to override the function > report-problem to > integrate it into other test framework lik

overrding function from other namespace

2010-03-19 Thread Martin Hauner
Hi, I trying to use clojure.contrib.mock. It says to override the function report-problem to integrate it into other test framework like clojure.test. I've got this working, but the namespace switching looks a bit ugly. Is there a better way to handle this? Maybe something like (ns clojure.contr