[openstack-dev] [horizon] mocking policy

Jiri Tomasek jtomasek at redhat.com
Wed Jun 11 12:42:57 UTC 2014


On 06/10/2014 12:01 PM, Maxime Vidori wrote:
> +1 for the use of mock.
>
> Is mox3 really needed? Or can we move our tests for python3 to mock, and use this library for every tests for python3?
>
> ----- Original Message -----
> From: "David Lyle" <david.lyle at hp.com>
> To: "OpenStack Development Mailing List (not for usage questions)" <openstack-dev at lists.openstack.org>
> Sent: Tuesday, June 10, 2014 5:58:07 AM
> Subject: Re: [openstack-dev] [horizon] mocking policy
>
> I have no problem with this proposal.
>
> David
>
> On 6/4/14, 6:41 AM, "Radomir Dopieralski" <openstack at sheep.art.pl> wrote:
>
>> Hello,
>>
>> I'd like to start a discussion about the use of mocking libraries in
>> Horizon's tests, in particular, mox and mock.
>>
>> As you may know, Mox is the library that has been used so far, and we
>> have a lot of tests written using it. It is based on a similar Java
>> library and does very strict checking, although its error reporting may
>> leave something more to be desired.
>>
>> Mock is a more pythonic library, insluded in the stdlib of recent Python
>> versions, but also available as a separate library for older pythons. It
>> has a much more relaxed approach, allowing you to only test the things
>> that you actually care about and to write tests that don't have to be
>> rewritten after each and every refactoring.
>>
>> Some OpenStack projects, such as Nova, seem to have adopted an approach
>> that favors Mock in newly written tests, but allows use of Mox for older
>> tests, or when it's more suitable for the job.
>>
>> In Horizon we only use Mox, and Mock is not even in requirements.txt. I
>> would like to propose to add Mock to requirements.txt and start using it
>> in new tests where it makes more sense than Mox -- in particular, when
>> we are writing unit tests only testing small part of the code.
>>
>> Thoughts?
>> -- 
>> Radomir Dopieralski
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
+1

Thanks for bringing this up.


Jirka



More information about the OpenStack-dev mailing list