title: Pytest fixture with scope "class" running on every method
body: <p>I'm trying to create a test environment with Pytest. The idea is to group test methods into classes. </p>
  
  <p>For every class/group, I want to attach a <code>config</code> fixture that is going to be parametrized. So that I can run all the tests with "configuration A" and then all tests with "configuration B" and so on.</p>
  
  <p>But also, I want a <code>reset</code> fixture, that can be executed before specific methods or all methods of a class.</p>
  
  <p><strong>The problem I have there is, once I apply my <code>reset</code> fixture (to a method or to a whole class), the <code>config</code> fixture seems to work in the function scope instead of the class scope. So, once I apply the <code>reset</code> fixture, the <code>config</code> fixture is called before/after every method in the class.</strong></p>
  
  <p>The following piece of code reproduces the problem:</p>
  
  <pre><code>import pytest
  from pytest import *
  
  @fixture(scope='class')
  def config(request):
      print("\nconfiguring with %s" % request.param)
      yield
      print("\ncleaning up config")
  
  @fixture(scope='function')
  def reset():
      print("\nreseting")
  
  @mark.parametrize("config", ["config-A", "config-B"], indirect=True)
  #@mark.usefixtures("reset")
  class TestMoreStuff(object):
  
      def test_a(self, config):
          pass
  
      def test_b(self, config):
          pass
  
      def test_c(self, config):
          pass
  </code></pre>
  
  <p>The test shows how the <code>config</code> fixture should work, being executed only once for the whole class. If you uncomment the <code>usefixtures</code> decoration, you can notice that the <code>config</code> fixture will be executed in every test method. <strong>Is it possible to use the <code>reset</code> fixture without triggering this behaviour?</strong></p>