title: Why doesn't pytest load conftest.py when running only a subset of tests?
body: <p>Here is my API test directory layout:</p>
  <pre><code>api_tests
  ├── conftest.py
  └── query
      └── me_test.py
  </code></pre>
  <p>Contents of conftest.py:</p>
  <pre class="lang-py prettyprint-override"><code>print(&quot;CONFTEST LOADED&quot;)
  </code></pre>
  <p>Contents of me_test.py:</p>
  <pre class="lang-py prettyprint-override"><code>&quot;&quot;&quot;Tests the &quot;me&quot; query&quot;&quot;&quot;
  
  def test_me():
      assert True
  </code></pre>
  <p>If I simply run <code>pytest</code>, everything works:</p>
  <pre><code>================================================= test session starts =================================================
  platform linux -- Python 3.8.5, pytest-6.1.0, py-1.9.0, pluggy-0.13.1
  rootdir: /home/hubro/myproject, configfile: pytest.ini
  collecting ... CONFTEST LOADED
  collected 3 items                                                                                                     
  
  api_tests/query/me_test.py .                                                                                    [ 33%]
  lib/myproject/utils_test.py .                                                                                   [ 66%]
  lib/myproject/schema/types/scalars_test.py .                                                                    
  </code></pre>
  <p>Notice &quot;CONFTEST LOADED&quot; is printed. Great! However, this test run also picked up all my unit tests, which I don't want. I want to separate my test runs into unit tests and API tests, I don't want to run them all in one go.</p>
  <p>However, if I simply run <code>pytest api_tests/</code>:</p>
  <pre><code>================================================= test session starts =================================================
  platform linux -- Python 3.8.5, pytest-6.1.0, py-1.9.0, pluggy-0.13.1
  rootdir: /home/hubro/myproject, configfile: pytest.ini
  collected 1 item                                                                                                      
  
  api_tests/query/me_test.py .                                                                                    [100%]
  
  ================================================== 1 passed in 0.00s ==================================================
  </code></pre>
  <p>Now the right tests are run, but the conftest.py file wasn't loaded... How come?</p>
  <hr />
  <p>I am using Pytest 6.1.0 on Python 3.8.</p>
  <hr />
  <p>EDIT: Alright, I found an acceptable workaround. I can override INI file options through the command line with the <code>-o</code> option. This works:</p>
  <pre><code>poetry run pytest -o &quot;testpaths=api_tests&quot;
  </code></pre>
  <p>However, I would very much like an answer to the original question so I'm not going to delete it.</p>