[openstack-dev] [horizon] mocking policy

Maxime Vidori maxime.vidori at enovance.com
Tue Jun 10 10:01:27 UTC 2014

+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.


On 6/4/14, 6:41 AM, "Radomir Dopieralski" <openstack at sheep.art.pl> wrote:

>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.
>Radomir Dopieralski
>OpenStack-dev mailing list
>OpenStack-dev at lists.openstack.org

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

More information about the OpenStack-dev mailing list