title: Pytest: How to access command line arguments outside of a test
body: <p>I would like to access command line arguments passed to pytest from within a non-test class.</p>
  
  <p>I have added the following to my conftest.py file </p>
  
  <pre><code>def pytest_addoption(parser):  # pragma: no cover
    """Pytest hook to add custom command line option(s)."""
    group = parser.getgroup("Test", "My test option")
    group.addoption(
      "--stack",
      help="stack", metavar="stack", dest='stack', default=None)
  </code></pre>
  
  <p>But I can not work out how to access the value passed on the command line.  I have found code on how to access it from a fixture, but I would like to access it from a method or class that is not part of the test case.</p>