def METHOD_NAME(request) -> typing.Generator:
    # save a copy of the middlewares. we would want to restore them once we're done with the test
    user_middleware = app.user_middleware.copy()
    try:
        if request.param == "without_middleware":
            # this overrides the webapp middlewares by removing the logging middleware
            app.user_middleware = []
            app.middleware_stack = app.build_middleware_stack()
        app.include_router(test_router, prefix="/test")
        with TestClient(app) as c:
            yield c
    finally:
        # restore back the middlewares
        if request.param == "without_middleware":
            app.user_middleware = user_middleware
            app.middleware_stack = app.build_middleware_stack()