import pytest
from sanic import Sanic
from sanic_openapi import swagger_blueprint


@pytest.fixture()
def app():
    app = Sanic('test')
    app.blueprint(swagger_blueprint)
    return app

import pytest
from sanic import Sanic

import sanic_openapi


@pytest.fixture()
def app():
    app = Sanic("test")
    app.blueprint(sanic_openapi.swagger_blueprint)
    yield app

    # Clean up
    sanic_openapi.swagger.definitions = {}
    sanic_openapi.swagger._spec = {}

Add clean up in app fixture
Test: Add clean up in app fixture

  import pytest
  from sanic import Sanic
- from sanic_openapi import swagger_blueprint
+ 
+ import sanic_openapi
  
  
  @pytest.fixture()
  def app():
-     app = Sanic('test')
+     app = Sanic("test")
-     app.blueprint(swagger_blueprint)
+     app.blueprint(sanic_openapi.swagger_blueprint)
-     return app
+     yield app
  
+     # Clean up
+     sanic_openapi.swagger.definitions = {}
+     sanic_openapi.swagger._spec = {}
+ 
Add clean up in app fixture
## Code Before:
import pytest
from sanic import Sanic
from sanic_openapi import swagger_blueprint


@pytest.fixture()
def app():
    app = Sanic('test')
    app.blueprint(swagger_blueprint)
    return app

## Instruction:
Add clean up in app fixture
## Code After:
import pytest
from sanic import Sanic

import sanic_openapi


@pytest.fixture()
def app():
    app = Sanic("test")
    app.blueprint(sanic_openapi.swagger_blueprint)
    yield app

    # Clean up
    sanic_openapi.swagger.definitions = {}
    sanic_openapi.swagger._spec = {}
