On 11 November 2013 10:27, Rosa, Andrea (HP Cloud Services) <andrea.r...@hp.com> wrote: > Hi > >>Generally mock is supposed to be used over mox now for python 3 support. > > That is my understanding too
+1 But I don't think we should waste all our time re-writing all our mox and stub tests. Lets just leave this to happen organically for now as we add and refactor tests. We probably need to take the hit at some point, but that doesn't feel like we should do that right now. >>As for when to use mock vs stubs, I think you'll get different opinions from >>different people. Stubs are quick and easy and that's what I used early when I >>started contributing to the project, but since then have preferred mox/mock >>since they validate that methods are actually called with specific parameters, >>which can get lost when simply stubbing a method call out. In other words, if >>I'm stubbing a method and doing assertions within it (which you'll usually >>see), >>if that method is never called (maybe the code changed since the test was >>written), the assertions are lost and the test is essentially broken. >> >>So I think in general it's best to use mock now unless you have a good reason >>not to. +1 All new tests should use mock > AFAIK We all agree that for mocking we move to mock but there is no > indication about using mock or stub, and that's good to me. > Mocking and stubbing are two different philosophies, I don't think one is > better than the other. > I found this article [1] really useful. > HTH > Regards > > [1] http://martinfowler.com/articles/mocksArentStubs.html In mock things are stubs by default, which really handy. I like how the behaviour verification in mock sits in the same place as the state verification. In terms of books, I am quite a fan of the book by Roy Osherove. John _______________________________________________ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev