title: programmatically finding root directory of pytest before pytest test session starts
body: <p>If I run test cases using command "pytest -s -v"
  My test cases will get the root directory path where pytest.ini file is.</p>
  
  <p>But i want to find the root directory programmatically either in "conftest.py" file or from the files from "api" folder before python test session starts.
  Please NOTE: I want to get root directory before pytest test session starts</p>
  
  <p>I did lot of search on the internet but didnt get answer for my requirement.
  Please help</p>
  
  <p>I have python automation project structure as below.</p>
  
  <pre><code>api-automation
    api
      packagename
         __init__.py
         user.py
         payloads
           a.json
           b.json    
    tests
      test_1.py
      test_2.py
      conftest.py
    setup.cfg
    setup.py
    pytest.ini
    README.rst
  </code></pre>
  
  <p>content of conftest.py is as below</p>
  
  <pre><code>import pytest
  
  @pytest.fixture(scope='session', autouse=True)
  def root_directory(request):
      """
      :return:
      """
      return str(request.config.rootdir)
  </code></pre>
  
  <p>content of test_1.py as below,</p>
  
  <pre><code>def test_first(root_directory):
      print("root_directory", root_directory)
  </code></pre>