hi,
you may want to check out mock:
http://www.voidspace.org.uk/python/mock/examples.html#applying-the-same-patch-to-every-test-method

On Tue, Feb 28, 2012 at 1:11 PM, Craig Small <[email protected]> wrote:
> Hello,
>  Not sure if this is a tg2 question or not, but has anyone got a way
> of testing their code when it uses external functions?
>
> I've got a lot of code in my tg2 app that uses the network to get
> values. For testing I'd like to set these values to a known value.
> So when nosetests runs, the program doesn't go to the network it
> returns, say, the number 3. I will then check my bit of code outputs
> "Hello" because if it gets a 3, it should say "Hello".
>
> Any idea what this is called and how to make nosetest use my fake
> functions rather than some other module? I believe I might have to make
> a moc module.
>
> --
> Craig Small VK2XLZ   http://enc.com.au/          csmall at : enc.com.au
> Debian GNU/Linux     http://www.debian.org/      csmall at : debian.org
> GPG fingerprint:     5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5
>
> --
> You received this message because you are subscribed to the Google Groups 
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/turbogears?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to