Good point.

I assume someone made a comparison similar to this:
* http://garybernhardt.github.io/python-mock-comparison/

... and evangelized a choice. I had assumed that Mock vs mox was not merely 
based on Python3 support but had something to do with Mock versus Mox. Does 
anyone have that context in their head? Would they mind sharing it?

# Shawn Hartsock


----- Original Message -----
> From: "Mark McLoughlin" <mar...@redhat.com>
> To: "Shawn Hartsock" <hartso...@vmware.com>
> Cc: "OpenStack Development Mailing List (not for usage questions)" 
> <openstack-dev@lists.openstack.org>
> Sent: Tuesday, November 12, 2013 4:24:08 PM
> Subject: Re: [openstack-dev] [nova] Do we have some guidelines for mock, 
> stub, mox when writing unit test?
> 
> 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.
> 
> Or maybe it has nothing to do with Python3 at all? Maybe we just like
> mock more? But do we like it enough to have a mixture of mock and mox
> across the codebase?
> 
> Mark.
> 
> > ----- Original Message -----
> > > From: "John Garbutt" <j...@johngarbutt.com>
> > > To: "Mark McLoughlin" <mar...@redhat.com>, "OpenStack Development Mailing
> > > List (not for usage questions)"
> > > <openstack-dev@lists.openstack.org>
> > > Sent: Tuesday, November 12, 2013 9:31:25 AM
> > > Subject: Re: [openstack-dev] [nova] Do we have some guidelines for mock,
> > > stub, mox when writing unit test?
> > > 
> > > On 11 November 2013 23:18, Mark McLoughlin <mar...@redhat.com> wrote:
> > > > On Mon, 2013-11-11 at 12:07 +0000, John Garbutt wrote:
> > > >> 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.
> > > >
> > > > Hmm, I don't follow this stance.
> > > >
> > > > Adding Python3 support is a goal we all share.
> > > >
> > > > If we're saying that the use of mox stands in the way of that goal, but
> > > > that we'd really prefer if people didn't work on porting tests from mox
> > > > to mock yet ... then are we saying we don't value people working on
> > > > porting to Python3?
> > > >
> > > > And if we plan to use a Python3 compatible version of mox[1], then
> > > > isn't
> > > > the Python3 argument irrelevant and saying "use mock for new tests"
> > > > just
> > > > means we'll end up with a mixture of mox and mock?
> > > 
> > > Good point, I forgot about the port of mox to python3.
> > > 
> > > I liked the idea of "prefer mock", with a view that at some point in
> > > the future there is only a small amount of mox related code left, that
> > > can easily get moved to mock.
> > > 
> > > I guess its a trade off between review capacity, risk of breaking
> > > existing tests, and risk of never reaching that end goal.
> > > 
> > > We already have stubs and mox, which do tend to fight each other,
> > > adding a third does seem like a bad plan, unless there is a very good
> > > reason, which I always had in my head as python3 support. Hmm... I do
> > > prefer mock to mox, but not that strongly.
> > > 
> > > John
> > > 
> > > _______________________________________________
> > > OpenStack-dev mailing list
> > > OpenStack-dev@lists.openstack.org
> > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> > > 
> 

_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to