
import pytest

from tests.base import create_admin_app
from tests.conftest import database_recreated


@pytest.fixture(scope='session')
def admin_app_without_db(db):
    app = create_admin_app()
    with app.app_context():
        yield app


@pytest.fixture(scope='module')
def app(admin_app_without_db, db):
    app = admin_app_without_db
    with database_recreated(db):
        yield app


import pytest

from tests.conftest import database_recreated


@pytest.fixture(scope='module')
def app(admin_app, db):
    app = admin_app
    with app.app_context():
        with database_recreated(db):
            yield app

Use existing `admin_app` fixture for admin tests
Use existing `admin_app` fixture for admin tests

  
  import pytest
  
- from tests.base import create_admin_app
  from tests.conftest import database_recreated
  
  
- @pytest.fixture(scope='session')
+ @pytest.fixture(scope='module')
- def admin_app_without_db(db):
+ def app(admin_app, db):
-     app = create_admin_app()
+     app = admin_app
      with app.app_context():
+         with database_recreated(db):
-         yield app
+             yield app
  
- 
- @pytest.fixture(scope='module')
- def app(admin_app_without_db, db):
-     app = admin_app_without_db
-     with database_recreated(db):
-         yield app
- 
Use existing `admin_app` fixture for admin tests
## Code Before:

import pytest

from tests.base import create_admin_app
from tests.conftest import database_recreated


@pytest.fixture(scope='session')
def admin_app_without_db(db):
    app = create_admin_app()
    with app.app_context():
        yield app


@pytest.fixture(scope='module')
def app(admin_app_without_db, db):
    app = admin_app_without_db
    with database_recreated(db):
        yield app

## Instruction:
Use existing `admin_app` fixture for admin tests
## Code After:

import pytest

from tests.conftest import database_recreated


@pytest.fixture(scope='module')
def app(admin_app, db):
    app = admin_app
    with app.app_context():
        with database_recreated(db):
            yield app
