Ver Fonte

try to fix tests by clearing app.user_middlewares

Rodja Trappe há 2 anos atrás
pai
commit
f96527836d
1 ficheiros alterados com 1 adições e 0 exclusões
  1. 1 0
      tests/conftest.py

+ 1 - 0
tests/conftest.py

@@ -40,6 +40,7 @@ def reset_globals() -> Generator[None, None, None]:
     for path in {'/'}.union(globals.page_routes.values()):
     for path in {'/'}.union(globals.page_routes.values()):
         globals.app.remove_route(path)
         globals.app.remove_route(path)
     globals.app.middleware_stack = None
     globals.app.middleware_stack = None
+    globals.app.user_middleware.clear()
     # NOTE favicon routes must be removed separately because they are not "pages"
     # NOTE favicon routes must be removed separately because they are not "pages"
     [globals.app.routes.remove(r) for r in globals.app.routes if r.path.endswith('/favicon.ico')]
     [globals.app.routes.remove(r) for r in globals.app.routes if r.path.endswith('/favicon.ico')]
     importlib.reload(globals)
     importlib.reload(globals)