Mailing List Archive

mockmockmock
Quantum currently depends on both mox and mock for testing. I prefer mock's lightweight approach to mock's replay-centric way of doing things, but every other project in OpenStack uses mox exclusively. In an ideal world quantum could standardize on mock and show the other projects how much better it is vs mox, but in this pragmatic world, mock probably has to go.

I'm largely to blame for this state of affairs - I wasn't familiar enough with mox's stubout module and recommended using mock to cleanly perform monkey-patching during testing for the ryu plugin. Surveying the code, I see that the nvp plugin is also using mock for testing. That is the extent of it, though. Mock is used sparingly compared to mox, and its use could easily be replaced.

As much as I prefer mock, I think OpenStack projects have a responsibility to try to converge development tools and process where possible to minimize the developer knowledge necessary to be productive across projects. With that in mind, does anybody have any good arguments in favour of keeping mock? If not, I intend to file a bug that will result in mock's removal as a dependency.

Thanks,


Maru
--
Mailing list: https://launchpad.net/~netstack
Post to : netstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~netstack
More help : https://help.launchpad.net/ListHelp
Re: mockmockmock [ In reply to ]
On Thu, 2012-04-05 at 20:04 -0700, Maru Newby wrote:
> With that in mind, does anybody have any good arguments in favour of
> keeping mock?

PEP 417 - mock is in the stdlib as of Python 3.3.

Happy Hacking!

7-11


--
Mailing list: https://launchpad.net/~netstack
Post to : netstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~netstack
More help : https://help.launchpad.net/ListHelp
Re: mockmockmock [ In reply to ]
+1 to mock

On Thu, Apr 5, 2012 at 10:51 PM, Jason Kölker <jkoelker@rackspace.com>wrote:

> On Thu, 2012-04-05 at 20:04 -0700, Maru Newby wrote:
> > With that in mind, does anybody have any good arguments in favour of
> > keeping mock?
>
> PEP 417 - mock is in the stdlib as of Python 3.3.
>
> Happy Hacking!
>
> 7-11
>
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help : https://help.launchpad.net/ListHelp
>
Re: mockmockmock [ In reply to ]
So, there are mock adherents other than me. And apparently no strong voices advocating for removal. Should it co-exist alongside mox then? Should there be a preference as to how new tests are implemented? If replay is desired, mox may still be useful, although my own experience suggests that functionality requiring replay-oriented testing could likely benefit from testability improvements.

Thoughts?


On 2012-04-06, at 1:23 PM, Trey Morris wrote:

> +1 to mock
>
> On Thu, Apr 5, 2012 at 10:51 PM, Jason Kölker <jkoelker@rackspace.com> wrote:
> On Thu, 2012-04-05 at 20:04 -0700, Maru Newby wrote:
> > With that in mind, does anybody have any good arguments in favour of
> > keeping mock?
>
> PEP 417 - mock is in the stdlib as of Python 3.3.
>
> Happy Hacking!
>
> 7-11
>
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help : https://help.launchpad.net/ListHelp
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help : https://help.launchpad.net/ListHelp
Re: mockmockmock [ In reply to ]
Hi Maru,

Thanks for brining this up. This might make for an interesting discussion
session on the "Common development" track at the summit.

I don't have enough experience using both frameworks to offer a technical
preference, but my main goal is that from a project perspective it is easy
for people to understand and modify other people's test code. Consistency
within Quantum is critical, and as you point out, consistency across
projects is highly desirable as well.

If nothing else, it would be good to come up with a community policy of
when one testing framework should be preferred versus the other, and to
make it part of our developer documentation, and have it be enforced as
part of the review process.

Dan


On Fri, Apr 6, 2012 at 1:44 PM, Maru Newby <mnewby@internap.com> wrote:

> So, there are mock adherents other than me. And apparently no strong
> voices advocating for removal. Should it co-exist alongside mox then?
> Should there be a preference as to how new tests are implemented? If
> replay is desired, mox may still be useful, although my own experience
> suggests that functionality requiring replay-oriented testing could likely
> benefit from testability improvements.
>
> Thoughts?
>
>
> On 2012-04-06, at 1:23 PM, Trey Morris wrote:
>
> +1 to mock
>
> On Thu, Apr 5, 2012 at 10:51 PM, Jason Kölker <jkoelker@rackspace.com>wrote:
>
>> On Thu, 2012-04-05 at 20:04 -0700, Maru Newby wrote:
>> > With that in mind, does anybody have any good arguments in favour of
>> > keeping mock?
>>
>> PEP 417 - mock is in the stdlib as of Python 3.3.
>>
>> Happy Hacking!
>>
>> 7-11
>>
>>
>> --
>> Mailing list: https://launchpad.net/~netstack
>> Post to : netstack@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~netstack
>> More help : https://help.launchpad.net/ListHelp
>>
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help : https://help.launchpad.net/ListHelp
>
>
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help : https://help.launchpad.net/ListHelp
>
>


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Wendlandt
Nicira, Inc: www.nicira.com
twitter: danwendlandt
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: mockmockmock [ In reply to ]
Hi Dan,

Discussing the issue at ODS is definitely a good idea. Mock adherents may prefer its pythonic approach to the java-like semantics of mox, but it would still be good to have guidelines on when mox might be a more appropriate choice.

Thanks,


Maru


On 2012-04-07, at 10:43 AM, Dan Wendlandt wrote:

> Hi Maru,
>
> Thanks for brining this up. This might make for an interesting discussion session on the "Common development" track at the summit.
>
> I don't have enough experience using both frameworks to offer a technical preference, but my main goal is that from a project perspective it is easy for people to understand and modify other people's test code. Consistency within Quantum is critical, and as you point out, consistency across projects is highly desirable as well.
>
> If nothing else, it would be good to come up with a community policy of when one testing framework should be preferred versus the other, and to make it part of our developer documentation, and have it be enforced as part of the review process.
>
> Dan
>
>
> On Fri, Apr 6, 2012 at 1:44 PM, Maru Newby <mnewby@internap.com> wrote:
> So, there are mock adherents other than me. And apparently no strong voices advocating for removal. Should it co-exist alongside mox then? Should there be a preference as to how new tests are implemented? If replay is desired, mox may still be useful, although my own experience suggests that functionality requiring replay-oriented testing could likely benefit from testability improvements.
>
> Thoughts?
>
>
> On 2012-04-06, at 1:23 PM, Trey Morris wrote:
>
>> +1 to mock
>>
>> On Thu, Apr 5, 2012 at 10:51 PM, Jason Kölker <jkoelker@rackspace.com> wrote:
>> On Thu, 2012-04-05 at 20:04 -0700, Maru Newby wrote:
>> > With that in mind, does anybody have any good arguments in favour of
>> > keeping mock?
>>
>> PEP 417 - mock is in the stdlib as of Python 3.3.
>>
>> Happy Hacking!
>>
>> 7-11
>>
>>
>> --
>> Mailing list: https://launchpad.net/~netstack
>> Post to : netstack@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~netstack
>> More help : https://help.launchpad.net/ListHelp
>>
>> --
>> Mailing list: https://launchpad.net/~netstack
>> Post to : netstack@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~netstack
>> More help : https://help.launchpad.net/ListHelp
>
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help : https://help.launchpad.net/ListHelp
>
>
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Dan Wendlandt
> Nicira, Inc: www.nicira.com
> twitter: danwendlandt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
Re: mockmockmock [ In reply to ]
On Mon, 2012-04-09 at 21:48 -0700, Maru Newby wrote:
> Discussing the issue at ODS is definitely a good idea. Mock adherents
> may prefer its pythonic approach to the java-like semantics of mox,
> but it would still be good to have guidelines on when mox might be a
> more appropriate choice.

Mox is a good choice if you want to write a mocking library (like mock).
It may have a few higher level functions, but it is really a mocking
framework. I would advocate that in light of the overwhelming support of
mock in the larger python community, mox would never be a more
appropriate choice.

http://www.voidspace.org.uk/python/mock/compare.html gives some ways to
accomplish things in the different libraries that gives a good overall
comparison (of course it is biased ;).

Looking forward to discussing more at the summit.

Happy Hacking!

7-11




--
Mailing list: https://launchpad.net/~netstack
Post to : netstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~netstack
More help : https://help.launchpad.net/ListHelp