[openstack-dev] [nova] Do we have some guidelines for mock, stub, mox when writing unit test?

Angus Salkeld asalkeld at redhat.com
Tue Nov 12 22:27:48 UTC 2013

On 12/11/13 21:49 +0000, Mark McLoughlin wrote:
>On Tue, 2013-11-12 at 16:42 -0500, Chuck Short wrote:
>> Hi
>> On Tue, Nov 12, 2013 at 4:24 PM, Mark McLoughlin <markmc at redhat.com>
>> wrote:
>>         On Tue, 2013-11-12 at 13:11 -0800, Shawn Hartsock wrote:
>>         > Maybe we should have some 60% rule... that is: If you change
>>         more than
>>         > half of a test... you should *probably* rewrite the test in
>>         Mock.
>>         A rule needs a reasoning attached to it :)
>>         Why do we want people to use mock?
>>         Is it really for Python3? If so, I assume that means we've
>>         ruled out the
>>         python3 port of mox? (Ok by me, but would be good to hear why)
>>         And, if
>>         that's the case, then we should encourage whoever wants to
>>         port mox
>>         based tests to mock.
>> The upstream maintainer is not going to port mox to python3 so we have
>> a fork of mox called mox3. Ideally, we would drop the usage of mox in
>> favour of mock so we don't have to carry a forked mox.
>Isn't that the opposite conclusion you came to here:
>i.e. using mox3 results in less code churn?

Can't we at least seperate the two concerns?

Move everything to mox3 for python3 - should just be mostly
import changes.

Then decide if we want to migrate to mock (I like mock, but it can be
lots of work changing it). In Heat new tests are done in mock, but
we are not wholesale migrating to mock - 'cos well there is lots of
better things to do.


>OpenStack-dev mailing list
>OpenStack-dev at lists.openstack.org

More information about the OpenStack-dev mailing list