title: pytest fixture of fixtures
body: <p>I am currently writing tests for a medium sized library (~300 files).
  Many classes in this library share the same testing scheme which were coded using pytest:</p>
  
  <p>File test_for_class_a.py:</p>
  
  <pre><code>import pytest
  
  @pytest.fixture()
  def setup_resource_1():
      ...
  
  @pytest.fixture()
  def setup_resource_2():
      ...
  
  @pytest.fixture()
  def setup_class_a(setup_resource_1, setup_resource_2):
      ...
  
  def test_1_for_class_a(setup_class_a):
      ...
  
  def test_2_for_class_a(setup_class_a):
      ...
  </code></pre>
  
  <p>similar files exist for class_b, class_c etc ... The only difference being the content of setup_resource_1 &amp; setup_resource_2.</p>
  
  <p>Now I would like to re-use the fixtures setup_class_a, setup_class_b, setup_class_c defined in test_for_class_a.py, test_for_class_b.py and test_for_class_c.py to run tests on them.</p>
  
  <p>In a file test_all_class.py, this works but it is limited to one fixture per test:</p>
  
  <pre><code>from test_for_class_a import *
  
  @pytest.mark.usefixtures('setup_class_a')      # Fixture was defined in test_for_class_a.py
  def test_some_things_on_class_a(request)
      ...
  </code></pre>
  
  <p>But I am looking for a way to perform something more general:</p>
  
  <pre><code>from test_for_class_a import *
  from test_for_class_b import *   # I can make sure I have no collision here 
  from test_for_class_c import *   # I can make sure I have no collision here 
  
  ==&gt; @generate_test_for_fixture('setup_class_a', 'setup_class_b', 'setup_class_c') 
  def test_some_things_on_all_classes(request)
      ...
  </code></pre>
  
  <p>Is there any way to do something close to that?
  I have been looking at factories of factories and abstract pytest factories but I am struggling with the way pytest defines fixture.
  Is there any way to solve this problems?</p>