[tor-commits] [stem/master] Adding pydocs for prior mocking change

atagar at torproject.org atagar at torproject.org
Wed Jun 20 16:38:52 UTC 2012


commit a4243fd09384fcbe37f076cf4ec6163c80f00839
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jun 20 09:37:40 2012 -0700

    Adding pydocs for prior mocking change
---
 test/mocking.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/test/mocking.py b/test/mocking.py
index 5a90f6e..e4245a9 100644
--- a/test/mocking.py
+++ b/test/mocking.py
@@ -76,8 +76,14 @@ def mock(target, mock_call, target_module=None):
   Mocks the given function, saving the initial implementation so it can be
   reverted later.
   
+  The target_module only needs to be set if the results of
+  'inspect.getmodule(target)' doesn't match the module that we want to mock
+  (for instance, the 'os' module provies the platform module that it wraps like
+  'postix', which won't work).
+  
   :param function target: function to be mocked
   :param functor mock_call: mocking to replace the function with
+  :param module target_module: module that this is mocking, this defaults to the inspected value
   """
   
   if hasattr(target, "__dict__") and "mock_id" in target.__dict__:



More information about the tor-commits mailing list