title: Can tests with pytest fixtures be run interactively?
body: <p>I have some tests written using pytest and fixtures, e.g.:</p>
  
  <pre><code>class TestThing:
      @pytest.fixture()
      def temp_dir(self, request):
          my_temp_dir = tempfile.mkdtemp()
          def fin():
              shutil.rmtree(my_temp_dir)
          request.addfinalizer(fin)
          return my_temp_dir
      def test_something(self, temp_dir)
          with open(os.path.join(temp_dir, 'test.txt'), 'w') as f:
              f.write('test')
  </code></pre>
  
  <p>This works fine when the tests are invoked from the shell, e.g.</p>
  
  <pre><code> $ py.test
  </code></pre>
  
  <p>but I don't know how to run them from within a python/ipython session; trying e.g. </p>
  
  <pre><code>tt = TestThing()
  tt.test_something(tt.temp_dir())
  </code></pre>
  
  <p>fails because <code>temp_dir</code> requires a <code>request</code> object to be passed on.  So, how does one invoke a fixture with a <code>request</code> object injected?</p>