50 lines
1.9 KiB
Python
50 lines
1.9 KiB
Python
|
|
"""Smoke tests for the Flet GUI module — verifies that imports work and that
|
||
|
|
each page builder is callable. We do NOT launch a real Flet window; we mock
|
||
|
|
the `flet.Page` object enough that the builders execute without errors.
|
||
|
|
|
||
|
|
If Flet isn't installed, these tests skip cleanly so the suite still passes
|
||
|
|
on console-only installs.
|
||
|
|
"""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
|
||
|
|
flet = pytest.importorskip("flet")
|
||
|
|
|
||
|
|
|
||
|
|
def test_gui_app_module_imports():
|
||
|
|
from gui import app # pylint: disable=import-outside-toplevel
|
||
|
|
# The module must expose the canonical 7 pages.
|
||
|
|
titles = [t for t, _ in app.PAGES]
|
||
|
|
assert "Главная" in titles
|
||
|
|
assert "Команды" in titles
|
||
|
|
assert "Макросы" in titles
|
||
|
|
assert "Расписание" in titles
|
||
|
|
assert "Память" in titles
|
||
|
|
assert "Плагины" in titles
|
||
|
|
assert "Настройки" in titles
|
||
|
|
|
||
|
|
|
||
|
|
def test_services_module_imports_cleanly():
|
||
|
|
# services pulls in memory_store, profiles_store, macros_store, scheduler_store
|
||
|
|
# and llm_backend. None of those should fail to import in a fresh process.
|
||
|
|
from gui import services # pylint: disable=import-outside-toplevel
|
||
|
|
# Just verify the public surface exists.
|
||
|
|
for fn in (
|
||
|
|
"memory_all", "memory_remember", "memory_forget", "memory_search",
|
||
|
|
"profile_list", "profile_active", "profile_set",
|
||
|
|
"macros_all", "macros_delete", "macros_recording",
|
||
|
|
"scheduler_all", "scheduler_remove",
|
||
|
|
"plugins_all", "plugins_open_folder", "plugins_set_enabled",
|
||
|
|
"llm_active", "llm_swap",
|
||
|
|
"assistant_run", "assistant_is_running",
|
||
|
|
):
|
||
|
|
assert callable(getattr(services, fn)), f"missing or non-callable: {fn}"
|
||
|
|
|
||
|
|
|
||
|
|
def test_each_page_module_exposes_build_callable():
|
||
|
|
from gui.pages import home, commands, macros, scheduler, memory, plugins, settings
|
||
|
|
for mod in (home, commands, macros, scheduler, memory, plugins, settings):
|
||
|
|
assert callable(getattr(mod, "build", None)), \
|
||
|
|
f"{mod.__name__}.build missing"
|