Browse Source

fix reset_globals between tests

Falko Schindler 2 years ago
parent
commit
2eec06bbad
1 changed files with 3 additions and 0 deletions
  1. 3 0
      tests/conftest.py

+ 3 - 0
tests/conftest.py

@@ -38,9 +38,12 @@ def selenium(selenium: webdriver.Chrome) -> webdriver.Chrome:
 
 
 @pytest.fixture(autouse=True)
 @pytest.fixture(autouse=True)
 def reset_globals() -> Generator[None, None, None]:
 def reset_globals() -> Generator[None, None, None]:
+    globals.app.routes[:] = [route for route in globals.app.routes
+                             if route.path != '/' and route.path not in globals.page_routes.values()]
     importlib.reload(globals)
     importlib.reload(globals)
     globals.error_client = ErrorClient(page(''))
     globals.error_client = ErrorClient(page(''))
     globals.index_client = IndexClient(page('/')).__enter__()
     globals.index_client = IndexClient(page('/')).__enter__()
+    globals.app.get('/')(globals.index_client.build_response)
 
 
 
 
 @pytest.fixture(scope='session', autouse=True)
 @pytest.fixture(scope='session', autouse=True)