浏览代码

fix reset_globals between tests

Falko Schindler 2 年之前
父节点
当前提交
2eec06bbad
共有 1 个文件被更改,包括 3 次插入0 次删除
  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)
 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)
     globals.error_client = ErrorClient(page(''))
     globals.index_client = IndexClient(page('/')).__enter__()
+    globals.app.get('/')(globals.index_client.build_response)
 
 
 @pytest.fixture(scope='session', autouse=True)