title: ImportError: Unable to run pytest on simple flask blueprint application
body: <p>I have a simple flask blueprint application with the following folder structure.</p>
  
  <pre><code>.
  ├── backend
  │   ├── app.py
  │   ├── __init__.py
  │   └── routes
  │       ├── index.py
  │       └── __init__.py
  └── test
      ├── __init__.py
      └── test_index.py
  </code></pre>
  
  <p><strong>index.py</strong></p>
  
  <pre><code>from flask import Blueprint
  index_blueprint = Blueprint('index', __name__)
  
  @index_blueprint.route("/")
  def index():
      return "Hello"
  </code></pre>
  
  <p><strong>app.py</strong></p>
  
  <pre><code>from flask import Flask
  from routes.index import index_blueprint
  
  app = Flask(__name__)
  app.register_blueprint(index_blueprint)
  
  if __name__ == "__main__":
      app.run(debug=True)
  </code></pre>
  
  <p>The application is working fine but running pytest gives me the following error. I am confused why am I getting this error.</p>
  
  <pre><code>Hint: make sure your test modules/packages have valid Python names.
  Traceback:
  test_index.py:5: in &lt;module&gt;
      from backend.app import app
  ../backend/app.py:6: in &lt;module&gt;
      from routes.index import index_blueprint
  E   ImportError: No module named 'routes'
  </code></pre>