import pytest


@pytest.fixture(scope='module')
def app():
    from api import app
    return app

import pytest


@pytest.fixture(scope='module')
def app():
    from api import app, db

    app.config['TESTING'] = True
    db.create_all()

    return app

Fix default fixture to initialize database
Fix default fixture to initialize database

  import pytest
  
  
  @pytest.fixture(scope='module')
  def app():
-     from api import app
+     from api import app, db
+ 
+     app.config['TESTING'] = True
+     db.create_all()
+ 
      return app
  
Fix default fixture to initialize database
## Code Before:
import pytest


@pytest.fixture(scope='module')
def app():
    from api import app
    return app

## Instruction:
Fix default fixture to initialize database
## Code After:
import pytest


@pytest.fixture(scope='module')
def app():
    from api import app, db

    app.config['TESTING'] = True
    db.create_all()

    return app
