title: PyTest fails on a directory with multiple test files when modularizing fixtures
body: <p>I'm using Py.Test to test functions in a Python Flask app.</p>
  
  <p>I have the tests passing fine when I use one "app_test.py" file that contains all the fixtures and tests. Now that I've split the fixtures into their own module, and separated the tests into different modules which each import the fixtures module I'm running into issues. </p>
  
  <p>If I run tests on each module individually, everything passes fine:
  <code>pytest tests/test_1.py</code>, <code>pytest tests/test_2.py</code>, <code>pytest tests/test_3.py</code>, etc. However trouble starts if I want to run all the tests in sequence with one command, e.g. <code>pytest tests</code>.</p>
  
  <p>I get the first module of tests passing and all future ones report an error:</p>
  
  <pre><code>AssertionError: A setup function was called after the first request was handled.  
  This usually indicates a bug in the application where a module was not imported 
  and decorators or other functionality was called too late.
  E  To fix this make sure to import all your view modules, database models 
  and everything related at a central place before the application starts 
  serving requests.
  </code></pre>
  
  <p>All the tests and fixtures in one file looks something like this:</p>
  
  <pre><code># app_test.py
  
  from flask_app import create_app
  @pytest.fixtures(scope="session")
  def app(request):
      app = create_app()
      with app.app_context():
          yield app
  
  @pytest.fixture(scope="session"):
  def client(request, app):
      client = app.test_client()
      return client
  
  
  def test1(client):
      # test body
  
  def test2(client):
      # test body
  
  ...
  </code></pre>
  
  <p>I run <code>$ pytest app_test.py</code> and everything runs perfectly.</p>
  
  <p>Now let's say we split those into three different modules: fixures.py, test_1.py and test_2.py. The code now looks like this.</p>
  
  <pre><code># tests/fixtures.py
  from flask_app import create_app
  @pytest.fixtures(scope="session")
  def app(request):
      app = create_app()
      with app.app_context():
          yield app
  
  @pytest.fixture(scope="session"):
  def client(request, app):
      client = app.test_client()
      return client
  </code></pre>
  
  <hr>
  
  <pre><code># tests/test_1.py
  from tests.fixtures import app, client
  def test_1(client):
      # test body
  </code></pre>
  
  <hr>
  
  <pre><code># tests/test_2.py
  from tests.fixtures import app, client
  def test_2(client):
      # test body
  </code></pre>
  
  <p>If we run <code>$ pytest tests</code> then tests/test_1.py will pass, and tests/test_2.py will raise the error.</p>
  
  <p>I've looked at this <a href="https://gist.github.com/peterhurford/09f7dcda0ab04b95c026c60fa49c2a68" rel="noreferrer">gist</a>, and have tried tagging the test functions with <code>@pytest.mark.usefixture</code> with no success.</p>
  
  <p>How can one run Py.Test with modularized fixtures on a directory that contains multiple test files?</p>