[Twisted-Python] Which mocker tool for trial ?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Feb 20 15:13:56 EST 2012


On 05:04 pm, nicolas.agius at lps-it.fr wrote:
>Hi,
>
>I'm writing unitests with Trial for my app.
>
>I use Python Mocker (http://labix.org/mocker) for making stubs and 
>mock. It work almost fine, but I have trouble mocking static methods. 
>It seems that Mocker does'nt work with static methods called from a 
>callback.

If Python Mocker is failing to handle some case, it's somewhat likely 
that it's not a problem caused by Twisted or Trial, but a problem with 
Python Mocker or a problem with the way you're using it.  Twisted is 
just a Python library, all of the normal Python rules still apply.
>
>Which tool are you using for mocking ?

I typically avoid mocking as a testing approach, preferring verified 
fakes due to their reduced maintenance overhead and the fewer 
metaprogramming tricks required to have them work.

Jean-Paul



More information about the Twisted-Python mailing list