Commits

Konstantine Rybnikov committed e0e5008

fix ppatch rewriting

Comments (0)

Files changed (3)

     """
     @wraps(patcher)
     def rv(name, *args, **kw):
-        new_kw = kw.copy()
-        new_kw.update(defaults)
-        return patcher(prefix + '.' + name, *args, **new_kw)
+        def_copy = defaults.copy()
+        def_copy.update(kw)
+        return patcher(prefix + '.' + name, *args, **def_copy)
     return rv
 
 
 
 ppatch = prefixed_p(__name__)
 # ppatch_autospec_M = prefixed_p(__name__, autospec=True, to_m=True)
+ppatch_autospec = prefixed_p(__name__, autospec=False)
 
 
 class TestPrefixedP(TestCase):
     def test_should_prefix_patch_here(self, se):
         self.assertRaises(TypeError, lambda: se.side_effect_five())
 
+    @ppatch_autospec('side_effect_five', autospec=True)
+    def test_should_rewrite_ppatch_param(self, se):
+        self.assertRaises(TypeError, lambda: se.side_effect_five())
+
     # @ppatch_autospec_M('side_effect_five')
     # def test_should_return_m_and_raise_typeerror(self, se):
     #     self.assertRaises(TypeError, lambda: se.side_effect_five())
     LONG_DESCRIPTION = f.read()
 
 setup(name='mockstar',
-      version='0.1.5',
+      version='0.1.6',
       description=DESCRIPTION,
       long_description=LONG_DESCRIPTION,
       author='Konstantine Rybnikov',