<div dir="ltr"><br><div class="gmail_extra">Hi<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 12, 2013 at 4:24 PM, Mark McLoughlin <span dir="ltr"><<a href="mailto:markmc@redhat.com" target="_blank">markmc@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, 2013-11-12 at 13:11 -0800, Shawn Hartsock wrote:<br>
> Maybe we should have some 60% rule... that is: If you change more than<br>
> half of a test... you should *probably* rewrite the test in Mock.<br>
<br>
</div>A rule needs a reasoning attached to it :)<br>
<br>
Why do we want people to use mock?<br>
<br>
Is it really for Python3? If so, I assume that means we've ruled out the<br>
python3 port of mox? (Ok by me, but would be good to hear why) And, if<br>
that's the case, then we should encourage whoever wants to port mox<br>
based tests to mock.<br>
<br></blockquote><div><br></div><div>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.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Or maybe it has nothing to do with Python3 at all? Maybe we just like<br>
mock more? But do we like it enough to have a mixture of mock and mox<br>
across the codebase?<br>
<span class="HOEnZb"><font color="#888888"><br>
Mark.<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> ----- Original Message -----<br>
> > From: "John Garbutt" <<a href="mailto:john@johngarbutt.com">john@johngarbutt.com</a>><br>
> > To: "Mark McLoughlin" <<a href="mailto:markmc@redhat.com">markmc@redhat.com</a>>, "OpenStack Development Mailing List (not for usage questions)"<br>
> > <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
> > Sent: Tuesday, November 12, 2013 9:31:25 AM<br>
> > Subject: Re: [openstack-dev] [nova] Do we have some guidelines for mock, stub, mox when writing unit test?<br>
> ><br>
> > On 11 November 2013 23:18, Mark McLoughlin <<a href="mailto:markmc@redhat.com">markmc@redhat.com</a>> wrote:<br>
> > > On Mon, 2013-11-11 at 12:07 +0000, John Garbutt wrote:<br>
> > >> On 11 November 2013 10:27, Rosa, Andrea (HP Cloud Services)<br>
> > >> <<a href="mailto:andrea.rosa@hp.com">andrea.rosa@hp.com</a>> wrote:<br>
> > >> > Hi<br>
> > >> ><br>
> > >> >>Generally mock is supposed to be used over mox now for python 3 support.<br>
> > >> ><br>
> > >> > That is my understanding too<br>
> > >><br>
> > >> +1<br>
> > >><br>
> > >> But I don't think we should waste all our time re-writing all our mox<br>
> > >> and stub tests. Lets just leave this to happen organically for now as<br>
> > >> we add and refactor tests. We probably need to take the hit at some<br>
> > >> point, but that doesn't feel like we should do that right now.<br>
> > ><br>
> > > Hmm, I don't follow this stance.<br>
> > ><br>
> > > Adding Python3 support is a goal we all share.<br>
> > ><br>
> > > If we're saying that the use of mox stands in the way of that goal, but<br>
> > > that we'd really prefer if people didn't work on porting tests from mox<br>
> > > to mock yet ... then are we saying we don't value people working on<br>
> > > porting to Python3?<br>
> > ><br>
> > > And if we plan to use a Python3 compatible version of mox[1], then isn't<br>
> > > the Python3 argument irrelevant and saying "use mock for new tests" just<br>
> > > means we'll end up with a mixture of mox and mock?<br>
> ><br>
> > Good point, I forgot about the port of mox to python3.<br>
> ><br>
> > I liked the idea of "prefer mock", with a view that at some point in<br>
> > the future there is only a small amount of mox related code left, that<br>
> > can easily get moved to mock.<br>
> ><br>
> > I guess its a trade off between review capacity, risk of breaking<br>
> > existing tests, and risk of never reaching that end goal.<br>
> ><br>
> > We already have stubs and mox, which do tend to fight each other,<br>
> > adding a third does seem like a bad plan, unless there is a very good<br>
> > reason, which I always had in my head as python3 support. Hmm... I do<br>
> > prefer mock to mox, but not that strongly.<br>
> ><br>
> > John<br>
> ><br>
> > _______________________________________________<br>
> > OpenStack-dev mailing list<br>
> > <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
> > <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
> ><br>
<br>
<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div></div>