title: pytest mock patch side_effect not iterate when used together with pytest.mark.parametrize
body: <p>I have the below pytest script and the <code>side_effect</code> value <code>[2, 6]</code> is not getting iterated. It is always stuck with value <code>2</code> in the test function <code>test_my_function</code>.</p>
  <p>My question is:</p>
  <p>How to make the <code>side_effect</code> value iterate together with <code>parametrize</code> test cases in function <code>test_my_function</code>. (assume we must use <code>parametrize</code>).</p>
  <pre><code>#!/usr/bin/env python3
  #
  
  import pytest
  
  def my_function(x):
      return x*2
  
  @pytest.fixture
  def mock_my_function(mocker):
      mocker.patch(
          __name__ + &quot;.my_function&quot;, side_effect=[2, 6]
      )
  
  @pytest.mark.parametrize(&quot;input, expect&quot;, [(1, 2), (3, 6)])
  def test_my_function(input, expect, mock_my_function):
      assert expect == my_function(input)
  
      
  </code></pre>