On 04 Jul 10:07, Nicolas Évrard wrote:
> * Cédric Krier  [2014-06-23 18:37 +0200]:
> >Hi,
> 
> Hello,
> 
> >For the review [1], I started to use a Mock object for testing because
> >it was easier this way. I choose to use the backport of the Python3
> >unittest.mock [2] [3]. I think we should stick to this library if we
> >need to do some mocking in the unittest.
> 
> Yesterday I took some time[1] to use mocks on some code I have written
> during the day.
> 
> Here are some observation I made:
> 
>    - it's really interesting to test only the small part of the code
>      you've written. You can rely on the assumption that everything
>      is working as expected it brings the true meaning of unit in
>      unittest!
> 
>    - a lot of boilerplate code is needed to write a correct test

Then your code is not enough divided or you are not testing one thing
so you should write a scenario.

>    - due to the amount of boilerplate code needed I am a bit afraid
>      that the test will be difficult to maintain
> 
>    - patching object is awesome but nesting patch in with statements
>      is a real indentation killer
> 
> All in all it's a very nice tool to have in our box because it makes
> test more 'unitary' but there is some little annoyances (but I might
> have missed the obvious).


-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgpf3Xw4Se5dO.pgp
Description: PGP signature

Reply via email to