<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Mark:<div><br></div><div>I think Maru is talking about the distinction between record/replay mocking and action/assertion mocking.<br><div><br></div><div>In record/replay mocking (e.g., mox) you define the expected behavior *before* executing the code under test (i.e., "I expect A, B, and C to happen, now go execute the code under test"), and in action/assertion mocking (e.g. mock), you check assertions *after* executing the code under test (i.e., "Go execute the code under test. Now check: did A, B, C, happen")? </div><div><br></div><div><div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Take care,</div><div><br></div><div>Lorin</div><div>--</div><div>Lorin Hochstein</div><div>Lead Architect - Cloud Services</div><div>Nimbis Services, Inc.</div><div><a href="https://www.nimbisservices.com/">www.nimbisservices.com</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Mar 1, 2012, at 10:03 PM, Mark Gius wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><span style="">Apologies to Maru for the double-email.  Left out the list by mistake.</span>
</div><span style=""><div><span style=""><br></span></div>When you say "non-replay mocking," are you talking about ensuring that a particular function is not called, or replacing a function/whatever with a lambda that doesn't care if it gets called or how often it gets called but still shims out say..a network request or whatever.  </span><div style="">
<br></div><div style="">The first is completely supported by mox and the second is just shimming in a lambda with some extra bookkeeping (which python 2.7/unittest2 makes significantly easier with the addCleanup function).</div>
<div style=""><br></div><div style="">Mark</div><br><div class="gmail_quote">On Thu, Mar 1, 2012 at 5:12 PM, Maru Newby <span dir="ltr"><<a href="mailto:mnewby@internap.com">mnewby@internap.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there any interest in adding unittest2 to the test dependencies for openstack projects?  I have found its enhanced assertions and 'with self.assertRaises' very useful in writing tests.  I see there have been past bugs that mentioned unittest2, and am wondering if the reasons for not adopting it still stand.<br>

<br>
Separately, is the use of mox open to discussion?  mock was recently added as a dependency to quantum to perform library patching, which isn't supported by mox as far as I know.  The ability to do non-replay mocking is another useful feature of mock.  I'm not suggesting that mox be replaced, but am wondering if mock could be an additional dependency and used when the functionality provided by mox falls short.<br>

<br>
Thanks,<br>
<br>
<br>
Maru<br>
_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
</blockquote></div><br>
_______________________________________________<br>Mailing list: <a href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a><br>Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>Unsubscribe : <a href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a><br>More help   : <a href="https://help.launchpad.net/ListHelp">https://help.launchpad.net/ListHelp</a><br></blockquote></div><br></div></div></div></body></html>