title: In pytest, how can I access the parameters passed to a test?
body: <p>In pytest, I can pass parameters to test (using fixtures or the decorator <code>@pytest.fixture(params=list-of-params)</code>). </p>
  
  <p>When the tests are done, if a test fails, the parameter that was passed is shown on the results, as in <code>TestCheckoutPage.test_address_edit[True]</code> or <code>False</code> if it was false. </p>
  
  <p>How can I access those parameters and add them to a finalizer? <code>request.param</code> doesn't seem to work, even though that is how you would get the parameter when making a fixture:</p>
  
  <pre><code>@pytest.fixture(params=[True, False])
  def user(request):
      return request.param
  </code></pre>
  
  <p>That works. But if I try to pass it to a test:</p>
  
  <pre><code>class TestClass:
      def test_something(self, user):
          pass
  </code></pre>
  
  <p>And then, using an autouse fixture to collect info on it:</p>
  
  <pre><code>@pytest.fixture(autouse=True)
  def set_driver(self, request):
      print request.param
  </code></pre>
  
  <p>That throws an error, saying there is no <code>param</code> in <code>FixtureRequest</code>.</p>
  
  <p>Is there a way that I can get that parameter back? I'm trying to have Selenium take a screenshot when tests fail, but because tests with parameters have the same name and classname and all, it is writing a file for the first execution, and then overwriting it the second, third, ..., time around. So I would like to add the parameter to the file name to avoid this. </p>
  
  <p>Thanks!</p>