title: Python mock() not mocking the return value
body: <p>I'm having some trouble with Python mock() and I'm not familiar enough to figure out what's going on with it.</p>
  
  <p>I have an abstract async task class that looks something like:</p>
  
  <pre><code>class AsyncTask(object):
      @classmethod
      def enqueue(cls):
          ....
          task_ent = cls.createAsyncTask(body, delayed=will_delay)
          ....
  </code></pre>
  
  <p>I'd like to patch the createAsyncTask method for a specific instance of this class.</p>
  
  <p>The code I wrote looks like:</p>
  
  <pre><code>@patch.object(CustomAsyncTaskClass, "createAsyncTask")
  def test_my_test(self, mock_create_task):
      ....
      mock_create_task.return_value = "12"
      fn()    # calls CustomAsyncTaskClass.enqueue(...)
      ....
  </code></pre>
  
  <p>When I print out task_ent in enqueue, I get <code>&lt;MagicMock name='createAsyncTask()' id='140578431952144'&gt;</code></p>
  
  <p>When I print out <code>cls.createAsyncTask</code> in enqueue, I get <code>&lt;MagicMock name='createAsyncTask' id='140578609336400'&gt;</code></p>
  
  <p>What am I doing wrong? Why won't createAsyncTask return 12?</p>