瀏覽代碼

mypy and pytest

Falko Schindler 1 年之前
父節點
當前提交
fa83252b5b
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      nicegui/testing/conftest.py
  2. 2 2
      nicegui/testing/screen.py

+ 2 - 2
nicegui/testing/conftest.py

@@ -69,7 +69,7 @@ def reset_globals() -> Generator[None, None, None]:
     importlib.reload(core)
     Client.instances.clear()
     Client.page_routes.clear()
-    Client.auto_index_client = Client(page('/'), shared=True).__enter__()
+    Client.auto_index_client = Client(page('/'), shared=True).__enter__()  # pylint: disable=unnecessary-dunder-call
     app.reset()
     # NOTE we need to re-add the auto index route because we removed all routes above
     app.get('/')(Client.auto_index_client.build_response)
@@ -86,7 +86,7 @@ def remove_all_screenshots() -> None:
 
 
 @pytest.fixture(scope='function')
-def driver(chrome_options: webdriver.ChromeOptions) -> webdriver.Chrome:
+def driver(chrome_options: webdriver.ChromeOptions) -> Generator[webdriver.Chrome, None, None]:
     """Create a new Chrome driver instance."""
     s = Service()
     driver_ = webdriver.Chrome(service=s, options=chrome_options)

+ 2 - 2
nicegui/testing/screen.py

@@ -4,7 +4,7 @@ import threading
 import time
 from contextlib import contextmanager
 from pathlib import Path
-from typing import List, Optional, Union
+from typing import Generator, List, Optional, Union
 
 import pytest
 from selenium import webdriver
@@ -230,7 +230,7 @@ class Screen:
             self.caplog.records.clear()
 
     @contextmanager
-    def implicitly_wait(self, t: float) -> None:
+    def implicitly_wait(self, t: float) -> Generator[None, None, None]:
         """Temporarily change the implicit wait time."""
         self.selenium.implicitly_wait(t)
         yield