MockPackage()
roger peppe
rogpeppe at gmail.com
Tue Mar 4 11:58:45 UTC 2014
On 3 March 2014 17:49, Nate Finch <nate.finch at canonical.com> wrote:
> John talked to me on a hangout and suggested that, often times, when you
> need to expose something like this for tests, it ends up being something
> that production code needs to tweak as well. He'd like to see something
> better than a public variable, but didn't offer a suggestion as to what.
>
> I think this is a pretty good point, so I'll try to come up with a third way
> that isn't too cumbersome.
I think a public variable is actually OK. We don't actually have to stipulate
that it should only be changed for testing, and the global nature of
should make it clear that it should not be changed other than at init time.
It's a pretty standard Go idiom to do this (see http.DefaultClient,
for example).
More information about the Juju-dev
mailing list