The changes look great! I see no issues with merging to the master branch.  Sorry about the reStructuredText inconvenience. I actually didn't even think of it -- I just meant to clean up the comments a bit, but I'll definitely be more careful in the future.<br>

<br>- Erik & Megan <br><br><div class="gmail_quote">On Thu, Jun 14, 2012 at 4:28 PM, Damian Johnson <span dir="ltr"><<a href="mailto:atagar@torproject.org" target="_blank">atagar@torproject.org</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">> We also updated your adaptation to our patch so that no code is repeated.<br>
> This should make the function cleaner and more readable.  This new code can<br>
> be found at:<br>
> <a href="https://github.com/jacthinman/Tor-Stem/blob/mocking/test/mocking.py" target="_blank">https://github.com/jacthinman/Tor-Stem/blob/mocking/test/mocking.py</a><br>
<br>
</div>Ah ha, makes much more sense now - thanks. After some reflection I<br>
realized that the mocking code was more convoluted that it needs to<br>
be. What do you think of this change instead?<br>
<br>
<a href="https://gitweb.torproject.org/user/atagar/stem.git/commitdiff/eb51eab0badf6b64d6119312478098686553f605" target="_blank">https://gitweb.torproject.org/user/atagar/stem.git/commitdiff/eb51eab0badf6b64d6119312478098686553f605</a><br>


<br>
It seems to handle both of our use cases while also axing much of the<br>
special handling for builtins...<br>
<br>
>>> import test.mocking<br>
>>> import time<br>
>>> my_mock = lambda i: i<br>
>>> test.mocking.mock(time.time, my_mock)<br>
>>> time.time(5)<br>
5<br>
>>> test.mocking.revert_mocking()<br>
>>> time.time()<br>
1339689308.64306<br>
<br>
>>> test.mocking.mock(open, my_mock)<br>
>>> open(5)<br>
5<br>
>>> test.mocking.revert_mocking()<br>
>>> open("/some_file", "r")<br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in <module><br>
IOError: [Errno 2] No such file or directory: '/some_file'<br>
<br>
If it looks good to you then I'll go ahead and merge this with master.<br>
Cheers! -Damian<br>
<br>
PS. Thanks for converting the mocking module to reStrcutredText.<br>
Usually that would have been a welcome improvement, however in this<br>
case I'd already converted it in the master branch so that actually<br>
generated merge conflicts with your patch. It's helpful if there's<br>
separate commits for separate changes (ie, a commit for the mocking<br>
changes and another for the reStructuredText conversion). That said, I<br>
don't always follow this rule either. ;)<br>
</blockquote></div><br>