title: Way to add pytest options outside top level conftest?
body: <p>I have a project that defines testing support modules, including py.test plugins in a package subdirectory like this:</p>
  
  <pre><code>bokeh/_testing
  ├── __init__.py
  ├── plugins
  │   ├── __init__.py
  │   ├── bokeh_server.py
  │   ├── examples_report.jinja
  │   ├── examples_report.py
  │   ├── file_server.py
  │   ├── implicit_mark.py
  │   ├── integration_tests.py
  │   ├── jupyter_notebook.py
  │   ├── log_file.py
  │   └── pandas.py
  └── util
      ├── __init__.py
      ├── api.py
      ├── examples.py
      ├── filesystem.py
      ├── git.py
      └── travis.py
  </code></pre>
  
  <p>Several of the plugins need to define new options with <code>parser.addoption</code>. I would like these calls to be made inside the respective plugin modules. However, if I do that, and include those plugins in a test file with, e.g.</p>
  
  <pre><code># test_examples.py
  pytest_plugins = (
      "bokeh.testing.plugins.bokeh_server",
      "bokeh.testing.plugins.examples_report",
  )
  
  # pytest.mark.examples test code here 
  </code></pre>
  
  <p>Then pytest complains that any custom command line options are undefined:</p>
  
  <pre><code>(base) ❯ py.test -s -v -m examples --diff-ref FETCH_HEAD --report-path=examples.html
  usage: py.test [options] [file_or_dir] [file_or_dir] [...]
  py.test: error: unrecognized arguments: --diff-ref --report-path=examples.html
    inifile: /Users/bryanv/work/bokeh/setup.cfg
    rootdir: /Users/bryanv/work/bokeh
  </code></pre>
  
  <p>The only way I have found around this, is to collect <strong><em>ALL</em></strong> custom options in a single <code>pytest_addoption</code> in the top-level <code>conftest.py</code>:</p>
  
  <pre><code># conftest.py
  pytest_plugins = (
      "bokeh.testing.plugins.implicit_mark",
      "bokeh.testing.plugins.pandas",
  )
  
  # Unfortunately these seem to all need to be centrally defined at the top level
  def pytest_addoption(parser):
      parser.addoption(
          "--upload", dest="upload", action="store_true", default=False, help="..."
      )
  
      # ... ALL other addoptions calls for all plugins here ...
  </code></pre>
  
  <p>As I said, this works, but is very inflexible in terms of code organization. It would be preferable to have a way for the options for the <code>examples.py</code> plugin to <em>in</em> the <code>examples.py</code> module, with the code it relates to. </p>
  
  <p>Another possibility would presumably be to bring in all the plugins in the top-level <code>conftest.py</code>, but some of the plugins are very heavyweight, e.g. depend on Selenium, and I would not like to require that all that be installed just to run basic tests. </p>
  
  <p>Is there another way to accomplish this, and if so, how?</p>