소스 검색

update pytests to import Screen from nicegui.testing

Falko Schindler 1 년 전
부모
커밋
8d373eca7f
74개의 변경된 파일77개의 추가작업 그리고 147개의 파일을 삭제
  1. 1 1
      .gitignore
  2. 1 1
      tests/README.md
  3. 1 0
      tests/conftest.py
  4. 1 2
      tests/test_aggrid.py
  5. 1 2
      tests/test_api_router.py
  6. 1 2
      tests/test_audio.py
  7. 1 2
      tests/test_auto_context.py
  8. 1 2
      tests/test_binding.py
  9. 1 2
      tests/test_button.py
  10. 1 2
      tests/test_carousel.py
  11. 1 2
      tests/test_chat.py
  12. 1 2
      tests/test_code.py
  13. 1 2
      tests/test_color_input.py
  14. 1 2
      tests/test_colors.py
  15. 1 2
      tests/test_context_menu.py
  16. 1 2
      tests/test_dark_mode.py
  17. 1 2
      tests/test_date.py
  18. 1 2
      tests/test_dialog.py
  19. 4 6
      tests/test_download.py
  20. 1 2
      tests/test_echart.py
  21. 1 2
      tests/test_editor.py
  22. 1 2
      tests/test_element.py
  23. 1 2
      tests/test_element_delete.py
  24. 1 2
      tests/test_endpoint_docs.py
  25. 1 2
      tests/test_events.py
  26. 1 2
      tests/test_expansion.py
  27. 1 2
      tests/test_favicon.py
  28. 1 2
      tests/test_header.py
  29. 1 2
      tests/test_highchart.py
  30. 1 2
      tests/test_image.py
  31. 1 2
      tests/test_input.py
  32. 1 2
      tests/test_interactive_image.py
  33. 1 2
      tests/test_javascript.py
  34. 1 2
      tests/test_joystick.py
  35. 1 2
      tests/test_json_editor.py
  36. 1 2
      tests/test_keyboard.py
  37. 1 2
      tests/test_knob.py
  38. 1 2
      tests/test_label.py
  39. 1 2
      tests/test_leaflet.py
  40. 1 2
      tests/test_lifecycle.py
  41. 1 2
      tests/test_link.py
  42. 1 2
      tests/test_log.py
  43. 1 2
      tests/test_markdown.py
  44. 1 2
      tests/test_menu.py
  45. 1 2
      tests/test_mermaid.py
  46. 1 2
      tests/test_notification.py
  47. 1 2
      tests/test_number.py
  48. 1 2
      tests/test_observables.py
  49. 1 2
      tests/test_open.py
  50. 1 2
      tests/test_page.py
  51. 1 2
      tests/test_page_title.py
  52. 1 2
      tests/test_pagination.py
  53. 1 2
      tests/test_plotly.py
  54. 1 2
      tests/test_prod_js.py
  55. 1 2
      tests/test_query.py
  56. 1 2
      tests/test_radio.py
  57. 1 2
      tests/test_refreshable.py
  58. 1 2
      tests/test_scene.py
  59. 1 2
      tests/test_select.py
  60. 1 1
      tests/test_serving_files.py
  61. 1 2
      tests/test_spinner.py
  62. 1 2
      tests/test_splitter.py
  63. 1 2
      tests/test_stepper.py
  64. 1 2
      tests/test_storage.py
  65. 1 2
      tests/test_table.py
  66. 1 2
      tests/test_tabs.py
  67. 1 2
      tests/test_tailwind.py
  68. 1 2
      tests/test_time.py
  69. 1 2
      tests/test_timeline.py
  70. 1 2
      tests/test_timer.py
  71. 1 2
      tests/test_toggle.py
  72. 1 2
      tests/test_tree.py
  73. 1 2
      tests/test_upload.py
  74. 1 2
      tests/test_video.py

+ 1 - 1
.gitignore

@@ -4,7 +4,7 @@ __pycache__/
 dist
 /test.py
 *.pickle
-tests/screenshots/
+screenshots/
 tests/media/
 venv
 .idea

+ 1 - 1
tests/README.md

@@ -61,7 +61,7 @@ Here is a very simple example:
 
 ```py
 from nicegui import ui
-from .screen import Screen
+from nicegui.testing import Screen
 
 def test_hello_world(screen: Screen):
     ui.label('Hello, world')

+ 1 - 0
tests/conftest.py

@@ -0,0 +1 @@
+from nicegui.testing.conftest import *  # pylint: disable=wildcard-import,unused-wildcard-import

+ 1 - 2
tests/test_aggrid.py

@@ -5,8 +5,7 @@ from selenium.webdriver.common.action_chains import ActionChains
 from selenium.webdriver.common.keys import Keys
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_update_table(screen: Screen):

+ 1 - 2
tests/test_api_router.py

@@ -1,7 +1,6 @@
 
 from nicegui import APIRouter, app, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_prefix(screen: Screen):

+ 1 - 2
tests/test_audio.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_replace_audio(screen: Screen):

+ 1 - 2
tests/test_auto_context.py

@@ -3,8 +3,7 @@ import asyncio
 from selenium.webdriver.common.by import By
 
 from nicegui import Client, background_tasks, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_adding_element_to_shared_index_page(screen: Screen):

+ 1 - 2
tests/test_binding.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.keys import Keys
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_ui_select_with_tuple_as_key(screen: Screen):

+ 1 - 2
tests/test_button.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_quasar_colors(screen: Screen):

+ 1 - 2
tests/test_carousel.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_carousel(screen: Screen):

+ 1 - 2
tests/test_chat.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.by import By
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_no_html(screen: Screen):

+ 1 - 2
tests/test_code.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_code(screen: Screen):

+ 1 - 2
tests/test_color_input.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.keys import Keys
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_entering_color(screen: Screen):

+ 1 - 2
tests/test_colors.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_replace_colors(screen: Screen):

+ 1 - 2
tests/test_context_menu.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_context_menu(screen: Screen):

+ 1 - 2
tests/test_dark_mode.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_dark_mode(screen: Screen):

+ 1 - 2
tests/test_date.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_date(screen: Screen):

+ 1 - 2
tests/test_dialog.py

@@ -3,8 +3,7 @@ from typing import List
 from selenium.webdriver.common.keys import Keys
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_open_close_dialog(screen: Screen):

+ 4 - 6
tests/test_download.py

@@ -5,9 +5,7 @@ import pytest
 from fastapi.responses import PlainTextResponse
 
 from nicegui import app, ui
-
-from .conftest import DOWNLOAD_DIR
-from .screen import Screen
+from nicegui.testing import Screen, conftest
 
 
 @pytest.fixture
@@ -27,7 +25,7 @@ def test_download_text_file(screen: Screen, test_route: str):  # pylint: disable
     screen.open('/')
     screen.click('Download')
     screen.wait(0.5)
-    assert (DOWNLOAD_DIR / 'test.txt').read_text() == 'test'
+    assert (conftest.DOWNLOAD_DIR / 'test.txt').read_text() == 'test'
 
 
 def test_downloading_local_file_as_src(screen: Screen):
@@ -38,7 +36,7 @@ def test_downloading_local_file_as_src(screen: Screen):
     route_count_before_download = len(app.routes)
     screen.click('download')
     screen.wait(0.5)
-    assert (DOWNLOAD_DIR / 'slide1.jpg').exists()
+    assert (conftest.DOWNLOAD_DIR / 'slide1.jpg').exists()
     assert len(app.routes) == route_count_before_download
 
 
@@ -48,4 +46,4 @@ def test_download_raw_data(screen: Screen):
     screen.open('/')
     screen.click('download')
     screen.wait(0.5)
-    assert (DOWNLOAD_DIR / 'test.txt').read_text() == 'test'
+    assert (conftest.DOWNLOAD_DIR / 'test.txt').read_text() == 'test'

+ 1 - 2
tests/test_echart.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_create_dynamically(screen: Screen):

+ 1 - 2
tests/test_editor.py

@@ -1,7 +1,6 @@
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_editor(screen: Screen):

+ 1 - 2
tests/test_element.py

@@ -2,8 +2,7 @@ import pytest
 from selenium.webdriver.common.by import By
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_classes(screen: Screen):

+ 1 - 2
tests/test_element_delete.py

@@ -1,6 +1,5 @@
 from nicegui import binding, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_remove_element_by_reference(screen: Screen):

+ 1 - 2
tests/test_endpoint_docs.py

@@ -3,8 +3,7 @@ from typing import Set
 import requests
 
 from nicegui import __version__
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def get_openapi_paths() -> Set[str]:

+ 1 - 2
tests/test_events.py

@@ -6,8 +6,7 @@ from selenium.webdriver.common.by import By
 
 from nicegui import ui
 from nicegui.events import ClickEventArguments
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def click_sync_no_args():

+ 1 - 2
tests/test_expansion.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_open_close_expansion(screen: Screen):

+ 1 - 2
tests/test_favicon.py

@@ -5,8 +5,7 @@ import requests
 from bs4 import BeautifulSoup
 
 from nicegui import favicon, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 DEFAULT_FAVICON_PATH = Path(__file__).parent.parent / 'nicegui' / 'static' / 'favicon.ico'
 LOGO_FAVICON_PATH = Path(__file__).parent.parent / 'website' / 'static' / 'logo_square.png'

+ 1 - 2
tests/test_header.py

@@ -1,8 +1,7 @@
 import pytest
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 @pytest.mark.parametrize('add_scroll_padding', [True, False])

+ 1 - 2
tests/test_highchart.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.by import By
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_change_chart_series(screen: Screen):

+ 1 - 2
tests/test_image.py

@@ -1,8 +1,7 @@
 from pathlib import Path
 
 from nicegui import app, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 example_file = Path(__file__).parent / '../examples/slideshow/slides/slide1.jpg'
 

+ 1 - 2
tests/test_input.py

@@ -2,8 +2,7 @@ from selenium.webdriver.common.by import By
 from selenium.webdriver.common.keys import Keys
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_input(screen: Screen):

+ 1 - 2
tests/test_interactive_image.py

@@ -2,8 +2,7 @@ import pytest
 from selenium.webdriver.common.action_chains import ActionChains
 
 from nicegui import Client, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_set_source_in_tab(screen: Screen):

+ 1 - 2
tests/test_javascript.py

@@ -1,8 +1,7 @@
 import pytest
 
 from nicegui import Client, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_run_javascript_on_button_press(screen: Screen):

+ 1 - 2
tests/test_joystick.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.action_chains import ActionChains
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_joystick(screen: Screen):

+ 1 - 2
tests/test_json_editor.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_json_editor_methods(screen: Screen):

+ 1 - 2
tests/test_keyboard.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_keyboard(screen: Screen):

+ 1 - 2
tests/test_knob.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_knob(screen: Screen):

+ 1 - 2
tests/test_label.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_hello_world(screen: Screen):

+ 1 - 2
tests/test_leaflet.py

@@ -1,8 +1,7 @@
 import time
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_leaflet(screen: Screen):

+ 1 - 2
tests/test_lifecycle.py

@@ -1,8 +1,7 @@
 from typing import List
 
 from nicegui import Client, app, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_adding_elements_during_onconnect_on_auto_index_page(screen: Screen):

+ 1 - 2
tests/test_link.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_local_target_linking_on_sub_pages(screen: Screen):

+ 1 - 2
tests/test_log.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_log(screen: Screen):

+ 1 - 2
tests/test_markdown.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_markdown(screen: Screen):

+ 1 - 2
tests/test_menu.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_menu(screen: Screen):

+ 1 - 2
tests/test_mermaid.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_mermaid(screen: Screen):

+ 1 - 2
tests/test_notification.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_notification(screen: Screen):

+ 1 - 2
tests/test_number.py

@@ -2,8 +2,7 @@ import pytest
 from selenium.webdriver.common.by import By
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_number_input(screen: Screen):

+ 1 - 2
tests/test_observables.py

@@ -3,8 +3,7 @@ import sys
 
 from nicegui import ui
 from nicegui.observables import ObservableDict, ObservableList, ObservableSet
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 # pylint: disable=global-statement
 count = 0

+ 1 - 2
tests/test_open.py

@@ -1,8 +1,7 @@
 import pytest
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 @pytest.mark.parametrize('new_tab', [False, True])

+ 1 - 2
tests/test_page.py

@@ -6,8 +6,7 @@ from fastapi.responses import PlainTextResponse
 from selenium.webdriver.common.by import By
 
 from nicegui import Client, background_tasks, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_page(screen: Screen):

+ 1 - 2
tests/test_page_title.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_page_title(screen: Screen):

+ 1 - 2
tests/test_pagination.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_pagination(screen: Screen):

+ 1 - 2
tests/test_plotly.py

@@ -2,8 +2,7 @@ import numpy as np
 import plotly.graph_objects as go
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_plotly(screen: Screen):

+ 1 - 2
tests/test_prod_js.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.by import By
 
 from nicegui import __version__
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_dev_mode(screen: Screen) -> None:

+ 1 - 2
tests/test_query.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_query_body(screen: Screen):

+ 1 - 2
tests/test_radio.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_changing_options(screen: Screen):

+ 1 - 2
tests/test_refreshable.py

@@ -1,8 +1,7 @@
 import asyncio
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_refreshable(screen: Screen) -> None:

+ 1 - 2
tests/test_scene.py

@@ -3,8 +3,7 @@ from selenium.common.exceptions import JavascriptException
 
 from nicegui import ui
 from nicegui.elements.scene_object3d import Object3D
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_moving_sphere_with_timer(screen: Screen):

+ 1 - 2
tests/test_select.py

@@ -4,8 +4,7 @@ import pytest
 from selenium.webdriver import Keys
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_select(screen: Screen):

+ 1 - 1
tests/test_serving_files.py

@@ -6,8 +6,8 @@ import pytest
 import requests
 
 from nicegui import __version__, app, ui
+from nicegui.testing import Screen
 
-from .screen import Screen
 from .test_helpers import TEST_DIR
 
 IMAGE_FILE = Path(TEST_DIR).parent / 'examples' / 'slideshow' / 'slides' / 'slide1.jpg'

+ 1 - 2
tests/test_spinner.py

@@ -1,8 +1,7 @@
 from selenium.webdriver.common.by import By
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_spinner(screen: Screen):

+ 1 - 2
tests/test_splitter.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_splitter(screen: Screen):

+ 1 - 2
tests/test_stepper.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_stepper(screen: Screen):

+ 1 - 2
tests/test_storage.py

@@ -4,8 +4,7 @@ from pathlib import Path
 import httpx
 
 from nicegui import Client, app, background_tasks, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_browser_data_is_stored_in_the_browser(screen: Screen):

+ 1 - 2
tests/test_table.py

@@ -5,8 +5,7 @@ import pandas as pd
 from selenium.webdriver.common.by import By
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def columns() -> List:

+ 1 - 2
tests/test_tabs.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_with_strings(screen: Screen):

+ 1 - 2
tests/test_tailwind.py

@@ -1,6 +1,5 @@
 from nicegui import Tailwind, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_tailwind_builder(screen: Screen):

+ 1 - 2
tests/test_time.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_time(screen: Screen):

+ 1 - 2
tests/test_timeline.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_timeline(screen: Screen):

+ 1 - 2
tests/test_timer.py

@@ -3,8 +3,7 @@ import asyncio
 import pytest
 
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 class Counter:

+ 1 - 2
tests/test_toggle.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_adding_toggle_options(screen: Screen):

+ 1 - 2
tests/test_tree.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_tree(screen: Screen):

+ 1 - 2
tests/test_upload.py

@@ -2,8 +2,7 @@ from pathlib import Path
 from typing import List
 
 from nicegui import events, ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 test_path1 = Path('tests/test_upload.py').resolve()
 test_path2 = Path('tests/test_scene.py').resolve()

+ 1 - 2
tests/test_video.py

@@ -1,6 +1,5 @@
 from nicegui import ui
-
-from .screen import Screen
+from nicegui.testing import Screen
 
 
 def test_replace_video(screen: Screen):