[TIP] Can you mock a function that has a decorator applies to it?
julian at grayvines.com
Wed Jul 4 10:50:28 PDT 2012
I'd probably expect you to mock out whatever the decorator is calling out
Barring that there's not really a general way to retrieve the original
function object off the decorated function without poking at its locals. At
that point you'd probably be better off just storing an undecorated
reference in your code to make it more testable.
On Wednesday, July 4, 2012, John Wong wrote:
> There are times when decorator really shine and I don't see a way to Mock
> out the decorator. I know it replaces the current function.... is there a
> way out of this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python