title: pytest - getting the value of fixture parameter
body: <p>Is there a way to save the value of parameter, provided by pytest fixture:</p>
  
  <p>Here is an example of conftest.py</p>
  
  <pre><code># content of conftest.py
  
  import pytest
  
  def pytest_addoption(parser):
      parser.addoption("--parameter", action="store", default="default",
                       help="configuration file path")
  
  @pytest.fixture
  def param(request):
      parameter = request.config.getoption("--parameter")
      return parameter
  </code></pre>
  
  <p>Here is an example of pytest module:</p>
  
  <pre><code># content of my_test.py
  
  def test_parameters(param):
      assert param == "yes"
  </code></pre>
  
  <p>OK - everything works fine, but is there a way to get the value of <code>param</code> outside the test - for example with some build-in pytest function <code>pytest.get_fixture_value["parameter"]</code> </p>
  
  <p><b>EDITED - DETAILED EXPLANATION WHAT I WANT TO ACHIEV</b></p>
  
  <p>I am writing an module, that deploys and after that provides parameters to tests, writen in pytest. My idea is if someones test looks like that:</p>
  
  <pre><code>class TestApproachI:
      @load_params_as_kwargs(parameters_A)
      def setup_class(cls, param_1, param_2, ... , param_n):
          # code of setup_class
  
      def teardown_class(cls):
          # some code
  
      def test_01(self):
          # test code
  </code></pre>
  
  <p>And this someone gives me a configuration file, that explains with what parameters to run his code, I will analyze those parameters (in some other script) and I will run his tests with the command <code>pytest --parameters=path_to_serialized_python_tuple test_to_run</code> where this tuple will contain the provided values for this someone parameters in the right order. And I will tell that guy (with the tests) to add this decorator to all the tests he wants me to provide parameters. This decorator would look like this:</p>
  
  <pre><code>class TestApproachI:
      # this path_to_serialized_tuple should be provided by 'pytest --parameters=path_to_serialized_python_tuple test_to_run'
      @load_params(path_to_serialized_tuple) 
      def setup_class(cls, param_1, param_2, ... , param_n):
          # code of setup_class
  
      def teardown_class(cls):
          # some code
  
      def test_01(self):
          # test code
  </code></pre>
  
  <p>The decorator function should look like that:</p>
  
  <pre><code>def load_params(parameters):
      def decorator(func_to_decorate):
          @wraps(func_to_decorate)
          def wrapper(self):
              # deserialize the tuple and decorates replaces the values of test parameters
              return func_to_decorate(self, *parameters)
          return wrapper
      return decorator
  </code></pre>