Falko Schindler преди 1 година
родител
ревизия
04eba6d578
променени са 3 файла, в които са добавени 6 реда и са изтрити 7 реда
  1. 0 1
      nicegui/functions/timer.py
  2. 5 5
      tests/screen.py
  3. 1 1
      tests/test_timer.py

+ 0 - 1
nicegui/functions/timer.py

@@ -4,7 +4,6 @@ from typing import Any, Awaitable, Callable, Optional
 
 
 from .. import background_tasks, globals
 from .. import background_tasks, globals
 from ..binding import BindableProperty
 from ..binding import BindableProperty
-from ..helpers import is_coroutine_function
 from ..slot import Slot
 from ..slot import Slot
 
 
 
 

+ 5 - 5
tests/screen.py

@@ -31,7 +31,7 @@ class Screen:
         self.ui_run_kwargs = {'port': PORT, 'show': False, 'reload': False}
         self.ui_run_kwargs = {'port': PORT, 'show': False, 'reload': False}
 
 
     def start_server(self) -> None:
     def start_server(self) -> None:
-        '''Start the webserver in a separate thread. This is the equivalent of `ui.run()` in a normal script.'''
+        """Start the webserver in a separate thread. This is the equivalent of `ui.run()` in a normal script."""
         self.server_thread = threading.Thread(target=ui.run, kwargs=self.ui_run_kwargs)
         self.server_thread = threading.Thread(target=ui.run, kwargs=self.ui_run_kwargs)
         self.server_thread.start()
         self.server_thread.start()
 
 
@@ -45,17 +45,17 @@ class Screen:
             return False
             return False
 
 
     def stop_server(self) -> None:
     def stop_server(self) -> None:
-        '''Stop the webserver.'''
+        """Stop the webserver."""
         self.close()
         self.close()
         self.caplog.clear()
         self.caplog.clear()
         globals.server.should_exit = True
         globals.server.should_exit = True
         self.server_thread.join()
         self.server_thread.join()
 
 
     def open(self, path: str, timeout: float = 3.0) -> None:
     def open(self, path: str, timeout: float = 3.0) -> None:
-        '''Try to open the page until the server is ready or we time out.
+        """Try to open the page until the server is ready or we time out.
 
 
         If the server is not yet running, start it.
         If the server is not yet running, start it.
-        '''
+        """
         if self.server_thread is None:
         if self.server_thread is None:
             self.start_server()
             self.start_server()
         deadline = time.time() + timeout
         deadline = time.time() + timeout
@@ -166,7 +166,7 @@ class Screen:
         self.selenium.get_screenshot_as_file(filename)
         self.selenium.get_screenshot_as_file(filename)
 
 
     def assert_py_logger(self, level: str, message: str) -> None:
     def assert_py_logger(self, level: str, message: str) -> None:
-        '''Assert that the Python logger has received a message with the given level and text'''
+        """Assert that the Python logger has received a message with the given level and text."""
         try:
         try:
             assert self.caplog.records, 'Expected a log message'
             assert self.caplog.records, 'Expected a log message'
             record = self.caplog.records[0]
             record = self.caplog.records[0]

+ 1 - 1
tests/test_timer.py

@@ -63,7 +63,7 @@ def test_setting_visibility(screen: Screen, once: bool):
     screen.should_not_contain('Some Label')
     screen.should_not_contain('Some Label')
 
 
 
 
-def test_awaiting_coroutine(screen: Screen, capfd):
+def test_awaiting_coroutine(screen: Screen):
     warnings.simplefilter('error')
     warnings.simplefilter('error')
 
 
     async def update_user():
     async def update_user():