title: Patching a parent class
body: <p>I'm having trouble getting a parent class mocked with <code>mock.patch</code>.</p>
  
  <p>Here's a test case:</p>
  
  <p>In <code>parent.py</code>:</p>
  
  <pre><code>import mock
  
  class Parent():
      def __init__(self):
          print("Original recipe")
  </code></pre>
  
  <p>In <code>child.py</code>:</p>
  
  <pre><code>from parent import Parent
  
  class Child(Parent):
      def foo(self):
          print('Parent is {}'.format(Parent))
  </code></pre>
  
  <p>In <code>test.py</code>:</p>
  
  <pre><code>import mock
  
  from child import Child
  
  c = Child()  # expect 'Original recipe'
  c.foo()
  
  with mock.patch('child.Parent'):
      c = Child() # expect silence
      c.foo()
  </code></pre>
  
  <p>When I run <code>test.py</code> I expect to get:</p>
  
  <pre><code>Original recipe
  Parent is &lt;class 'parent.Parent'&gt;
  Parent is &lt;MagicMock name='Parent' id='4325705712'&gt;    
  </code></pre>
  
  <p>but instead I get:</p>
  
  <pre><code>Original recipe
  Parent is &lt;class 'parent.Parent'&gt;
  Original recipe
  Parent is &lt;MagicMock name='Parent' id='4325705712'&gt;
  </code></pre>
  
  <p>So the patch is happening (from the "Parent is" statement) but not for the class inheritance. How can I fix that?</p>