mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 17:47:06 +08:00
test: fix tests for abstract ComputerBooter
ComputerBooter is now an abstract class, so tests that tried to instantiate it directly need to be updated: - test_booter_decoupling.py: remove test_get_tools_delegates_to_class since base class cannot be instantiated - test_profile_aware_tools.py: use ShipyardBooter.__new__() to test base class property defaults (capabilities, browser) - test_computer.py: skip BoxliteBooter test since it's also abstract and requires the boxlite module
This commit is contained in:
@@ -53,12 +53,6 @@ class TestComputerBooterBaseInterface:
|
||||
|
||||
assert ComputerBooter.get_default_tools() == []
|
||||
|
||||
def test_get_tools_delegates_to_class(self):
|
||||
from astrbot.core.computer.booters.base import ComputerBooter
|
||||
|
||||
booter = ComputerBooter()
|
||||
assert booter.get_tools() == []
|
||||
|
||||
def test_get_system_prompt_parts_returns_empty(self):
|
||||
from astrbot.core.computer.booters.base import ComputerBooter
|
||||
|
||||
|
||||
@@ -321,16 +321,20 @@ class TestResolveProfile:
|
||||
|
||||
|
||||
class TestBaseComputerBooter:
|
||||
"""Verify base class defaults."""
|
||||
"""Verify base class defaults via subclass."""
|
||||
|
||||
def test_capabilities_default_none(self):
|
||||
from astrbot.core.computer.booters.base import ComputerBooter
|
||||
"""Test that ComputerBooter base capabilities returns None by default."""
|
||||
from astrbot.core.computer.booters.shipyard import ShipyardBooter
|
||||
|
||||
booter = ComputerBooter()
|
||||
# ShipyardBooter is not abstract, can be instantiated to test defaults
|
||||
booter = ShipyardBooter.__new__(ShipyardBooter)
|
||||
assert booter.capabilities is None
|
||||
|
||||
def test_browser_default_none(self):
|
||||
from astrbot.core.computer.booters.base import ComputerBooter
|
||||
"""Test that ComputerBooter base browser returns None by default."""
|
||||
from astrbot.core.computer.booters.shipyard import ShipyardBooter
|
||||
|
||||
booter = ComputerBooter()
|
||||
# ShipyardBooter is not abstract, can be instantiated to test defaults
|
||||
booter = ShipyardBooter.__new__(ShipyardBooter)
|
||||
assert booter.browser is None
|
||||
|
||||
@@ -590,6 +590,7 @@ class TestShipyardBooter:
|
||||
class TestBoxliteBooter:
|
||||
"""Tests for BoxliteBooter."""
|
||||
|
||||
@pytest.mark.skip(reason="BoxliteBooter is now abstract and requires boxlite module")
|
||||
@pytest.mark.asyncio
|
||||
async def test_boxlite_booter_init(self):
|
||||
"""Test BoxliteBooter can be instantiated via __new__."""
|
||||
@@ -600,9 +601,9 @@ class TestBoxliteBooter:
|
||||
with patch.dict(sys.modules, {"boxlite": mock_boxlite}):
|
||||
from astrbot.core.computer.booters.boxlite import BoxliteBooter
|
||||
|
||||
# Just verify class exists and can be instantiated (boot is async)
|
||||
booter = BoxliteBooter.__new__(BoxliteBooter)
|
||||
assert booter is not None
|
||||
# BoxliteBooter is abstract now, cannot instantiate
|
||||
# This test is skipped
|
||||
pass
|
||||
|
||||
|
||||
class TestComputerClient:
|
||||
|
||||
Reference in New Issue
Block a user