code: def app():
      """Create and configure a new app instance for each test."""
      # create the app with common test config
      app = create_app(
          {
              "TESTING": True,
              "SQLALCHEMY_DATABASE_URI": "sqlite:///:memory:",
          }
      )
  
      # create the database and load test data
      # set _password to pre-generated hashes, since hashing for each test is slow
      with app.app_context():
          init_db()
          user = User(username="test", password_hash=_user1_pass)
          db.session.add_all(
              (
                  user,
                  User(username="other", password_hash=_user2_pass),
                  Post(
                      title="test title",
                      body="test\nbody",
                      author=user,
                      created=datetime(2018, 1, 1),
                  ),
              )
          )
          db.session.commit()
  
      yield app
  
file_path: flask-sqlalchemy/examples/flaskr/tests/conftest.py
imports: from datetime import datetime
  import pytest
  from werkzeug.security import generate_password_hash
  from flaskr import create_app
  from flaskr import db
  from flaskr import init_db
  from flaskr.auth.models import User
  from flaskr.blog.models import Post
label_desc: Use image node_id 1 for calling a global function with example usage: app() without return types