You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Refactor to simplify imports
This commit is contained in:
@@ -98,7 +98,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Args:
|
||||
iterations: Number of render iterations (default: DEFAULT_RENDER_ITERATIONS)
|
||||
"""
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import wait_for_render
|
||||
if iterations is None:
|
||||
iterations = self.DEFAULT_RENDER_ITERATIONS
|
||||
wait_for_render(iterations)
|
||||
@@ -115,7 +115,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Returns:
|
||||
bytes: The screenshot buffer
|
||||
"""
|
||||
from mpos.ui.testing import capture_screenshot
|
||||
from mpos import capture_screenshot
|
||||
|
||||
if width is None:
|
||||
width = self.SCREEN_WIDTH
|
||||
@@ -136,7 +136,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Returns:
|
||||
The label widget if found, None otherwise
|
||||
"""
|
||||
from mpos.ui.testing import find_label_with_text
|
||||
from mpos import find_label_with_text
|
||||
if parent is None:
|
||||
parent = lv.screen_active()
|
||||
return find_label_with_text(parent, text)
|
||||
@@ -152,7 +152,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Returns:
|
||||
bool: True if text is found
|
||||
"""
|
||||
from mpos.ui.testing import verify_text_present
|
||||
from mpos import verify_text_present
|
||||
if parent is None:
|
||||
parent = lv.screen_active()
|
||||
return verify_text_present(parent, text)
|
||||
@@ -164,7 +164,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Args:
|
||||
parent: Parent widget to search in (default: current screen)
|
||||
"""
|
||||
from mpos.ui.testing import print_screen_labels
|
||||
from mpos import print_screen_labels
|
||||
if parent is None:
|
||||
parent = lv.screen_active()
|
||||
print_screen_labels(parent)
|
||||
@@ -180,7 +180,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Returns:
|
||||
bool: True if button was found and clicked
|
||||
"""
|
||||
from mpos.ui.testing import click_button
|
||||
from mpos import click_button
|
||||
return click_button(text, use_send_event=use_send_event)
|
||||
|
||||
def click_label(self, text, use_send_event=True):
|
||||
@@ -194,7 +194,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
Returns:
|
||||
bool: True if label was found and clicked
|
||||
"""
|
||||
from mpos.ui.testing import click_label
|
||||
from mpos import click_label
|
||||
return click_label(text, use_send_event=use_send_event)
|
||||
|
||||
def simulate_click(self, x, y):
|
||||
@@ -208,7 +208,7 @@ class GraphicalTestBase(unittest.TestCase):
|
||||
x: X coordinate
|
||||
y: Y coordinate
|
||||
"""
|
||||
from mpos.ui.testing import simulate_click
|
||||
from mpos import simulate_click
|
||||
simulate_click(x, y)
|
||||
self.wait_for_render()
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class KeyboardTestBase(GraphicalTestBase):
|
||||
Returns:
|
||||
tuple: (keyboard, textarea)
|
||||
"""
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos import MposKeyboard
|
||||
|
||||
# Create textarea
|
||||
self.textarea = lv.textarea(self.screen)
|
||||
@@ -84,7 +84,7 @@ class KeyboardTestBase(GraphicalTestBase):
|
||||
Returns:
|
||||
bool: True if button was clicked successfully
|
||||
"""
|
||||
from mpos.ui.testing import click_keyboard_button
|
||||
from mpos import click_keyboard_button
|
||||
|
||||
if self.keyboard is None:
|
||||
raise RuntimeError("No keyboard created. Call create_keyboard_scene() first.")
|
||||
|
||||
@@ -49,7 +49,7 @@ class TestConnectivityManagerWithNetwork(unittest.TestCase):
|
||||
del sys.modules['mpos.net.connectivity_manager']
|
||||
|
||||
# Import fresh
|
||||
from mpos.net.connectivity_manager import ConnectivityManager
|
||||
from mpos import ConnectivityManager
|
||||
self.ConnectivityManager = ConnectivityManager
|
||||
|
||||
# Reset the singleton instance
|
||||
@@ -301,7 +301,7 @@ class TestConnectivityManagerWithoutNetwork(unittest.TestCase):
|
||||
if 'mpos.net.connectivity_manager' in sys.modules:
|
||||
del sys.modules['mpos.net.connectivity_manager']
|
||||
|
||||
from mpos.net.connectivity_manager import ConnectivityManager
|
||||
from mpos import ConnectivityManager
|
||||
self.ConnectivityManager = ConnectivityManager
|
||||
|
||||
# Reset the singleton instance
|
||||
@@ -382,7 +382,7 @@ class TestConnectivityManagerWaitUntilOnline(unittest.TestCase):
|
||||
if 'mpos.net.connectivity_manager' in sys.modules:
|
||||
del sys.modules['mpos.net.connectivity_manager']
|
||||
|
||||
from mpos.net.connectivity_manager import ConnectivityManager
|
||||
from mpos import ConnectivityManager
|
||||
self.ConnectivityManager = ConnectivityManager
|
||||
|
||||
ConnectivityManager._instance = None
|
||||
@@ -417,7 +417,7 @@ class TestConnectivityManagerWaitUntilOnline(unittest.TestCase):
|
||||
if 'mpos.net.connectivity_manager' in sys.modules:
|
||||
del sys.modules['mpos.net.connectivity_manager']
|
||||
|
||||
from mpos.net.connectivity_manager import ConnectivityManager
|
||||
from mpos import ConnectivityManager
|
||||
self.ConnectivityManager = ConnectivityManager
|
||||
ConnectivityManager._instance = None
|
||||
|
||||
@@ -439,7 +439,7 @@ class TestConnectivityManagerEdgeCases(unittest.TestCase):
|
||||
if 'mpos.net.connectivity_manager' in sys.modules:
|
||||
del sys.modules['mpos.net.connectivity_manager']
|
||||
|
||||
from mpos.net.connectivity_manager import ConnectivityManager
|
||||
from mpos import ConnectivityManager
|
||||
self.ConnectivityManager = ConnectivityManager
|
||||
|
||||
ConnectivityManager._instance = None
|
||||
@@ -550,7 +550,7 @@ class TestConnectivityManagerIntegration(unittest.TestCase):
|
||||
if 'mpos.net.connectivity_manager' in sys.modules:
|
||||
del sys.modules['mpos.net.connectivity_manager']
|
||||
|
||||
from mpos.net.connectivity_manager import ConnectivityManager
|
||||
from mpos import ConnectivityManager
|
||||
self.ConnectivityManager = ConnectivityManager
|
||||
|
||||
ConnectivityManager._instance = None
|
||||
|
||||
@@ -9,8 +9,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import MposKeyboard, wait_for_render
|
||||
|
||||
|
||||
class TestAbcButtonDebug(unittest.TestCase):
|
||||
|
||||
@@ -21,7 +21,7 @@ import mpos.apps
|
||||
import mpos.info
|
||||
import mpos.ui
|
||||
import os
|
||||
from mpos.ui.testing import (
|
||||
from mpos import (
|
||||
wait_for_render,
|
||||
capture_screenshot,
|
||||
find_label_with_text,
|
||||
|
||||
@@ -19,7 +19,7 @@ import unittest
|
||||
import lvgl as lv
|
||||
import mpos.ui.anim
|
||||
import time
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import wait_for_render
|
||||
|
||||
|
||||
class TestAnimationDeletedWidget(unittest.TestCase):
|
||||
@@ -130,7 +130,7 @@ class TestAnimationDeletedWidget(unittest.TestCase):
|
||||
"""
|
||||
print("Testing keyboard deletion scenario...")
|
||||
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos import MposKeyboard
|
||||
|
||||
# Create textarea and keyboard (like QuasiNametag does)
|
||||
textarea = lv.textarea(self.screen)
|
||||
|
||||
@@ -23,7 +23,7 @@ import mpos.apps
|
||||
import mpos.ui
|
||||
import os
|
||||
import sys
|
||||
from mpos.ui.testing import (
|
||||
from mpos import (
|
||||
wait_for_render,
|
||||
capture_screenshot,
|
||||
find_label_with_text,
|
||||
|
||||
@@ -13,11 +13,7 @@ import unittest
|
||||
import lvgl as lv
|
||||
import sys
|
||||
import os
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import (
|
||||
wait_for_render,
|
||||
capture_screenshot,
|
||||
)
|
||||
from mpos import MposKeyboard, wait_for_render, capture_screenshot
|
||||
|
||||
|
||||
class TestGraphicalMposKeyboard(unittest.TestCase):
|
||||
|
||||
@@ -10,8 +10,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import simulate_click, wait_for_render
|
||||
from mpos import MposKeyboard, simulate_click, wait_for_render
|
||||
|
||||
|
||||
class TestMposKeyboard(unittest.TestCase):
|
||||
|
||||
@@ -16,7 +16,7 @@ import mpos.ui
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from mpos.ui.testing import (
|
||||
from mpos import (
|
||||
wait_for_render,
|
||||
capture_screenshot,
|
||||
find_label_with_text,
|
||||
|
||||
@@ -16,7 +16,7 @@ import unittest
|
||||
|
||||
# Import graphical test infrastructure
|
||||
import lvgl as lv
|
||||
from mpos.ui.testing import (
|
||||
from mpos import (
|
||||
wait_for_render,
|
||||
simulate_click,
|
||||
find_button_with_text,
|
||||
@@ -91,7 +91,7 @@ class TestIMUCalibrationUI(unittest.TestCase):
|
||||
# Look for actual values (not "--")
|
||||
has_values_before = False
|
||||
widgets = []
|
||||
from mpos.ui.testing import get_all_widgets_with_text
|
||||
from mpos import get_all_widgets_with_text
|
||||
for widget in get_all_widgets_with_text(lv.screen_active()):
|
||||
text = widget.get_text()
|
||||
# Look for patterns like "X: 0.00" or "Quality: Good"
|
||||
|
||||
@@ -9,8 +9,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import MposKeyboard, wait_for_render
|
||||
|
||||
|
||||
class TestKeyboardCrash(unittest.TestCase):
|
||||
|
||||
@@ -10,8 +10,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import MposKeyboard, wait_for_render
|
||||
|
||||
|
||||
class TestDefaultVsCustomKeyboard(unittest.TestCase):
|
||||
|
||||
@@ -11,8 +11,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import MposKeyboard, wait_for_render
|
||||
|
||||
|
||||
class TestKeyboardLayoutSwitching(unittest.TestCase):
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos import MposKeyboard
|
||||
|
||||
|
||||
class TestMethodForwarding(unittest.TestCase):
|
||||
|
||||
@@ -11,8 +11,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import MposKeyboard, wait_for_render
|
||||
|
||||
|
||||
class TestKeyboardModeSwitch(unittest.TestCase):
|
||||
|
||||
@@ -11,8 +11,7 @@ Usage:
|
||||
|
||||
import unittest
|
||||
import lvgl as lv
|
||||
from mpos.ui.keyboard import MposKeyboard
|
||||
from mpos.ui.testing import wait_for_render
|
||||
from mpos import MposKeyboard, wait_for_render
|
||||
|
||||
|
||||
class TestRapidModeSwitching(unittest.TestCase):
|
||||
|
||||
@@ -22,7 +22,7 @@ import mpos.ui
|
||||
import mpos.config
|
||||
import sys
|
||||
import os
|
||||
from mpos.ui.testing import (
|
||||
from mpos import (
|
||||
wait_for_render,
|
||||
capture_screenshot,
|
||||
)
|
||||
|
||||
@@ -13,10 +13,7 @@ import time
|
||||
# This is a graphical test - needs boot and main to run first
|
||||
# Add tests directory to path for helpers
|
||||
|
||||
from mpos.ui.testing import wait_for_render
|
||||
import mpos.apps
|
||||
import mpos.ui
|
||||
from mpos.content.package_manager import PackageManager
|
||||
from mpos import wait_for_render, apps, ui, PackageManager
|
||||
|
||||
|
||||
class TestLaunchAllApps(unittest.TestCase):
|
||||
|
||||
@@ -6,7 +6,7 @@ import sys
|
||||
import os
|
||||
|
||||
# Import graphical test helper
|
||||
from mpos.ui.testing import (
|
||||
from mpos import (
|
||||
wait_for_render,
|
||||
capture_screenshot,
|
||||
find_label_with_text,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user