Files
AstrBot/tests/test_pipeline_context.py
LIghtJUNction dcaaf6286a test: comprehensive test coverage and type fixes
- Add 100+ new test files covering provider sources, platform adapters,
  agent runners, star/plugin system, knowledge base, core utils,
  pipeline, computer tools, builtin commands, and dashboard routes
- Fix Python type errors in sqlite.py (col() wrappers for SQLModel),
  astr_agent_tool_exec, core_lifecycle, star context/manager
- Fix TypeScript strict mode errors across 30+ dashboard Vue files
- Add import smoke tests, auth roundtrip, startup tests
- Add compile-all check and CLI entry test for AUR compatibility
- Restore BotMessageAccumulator and helpers lost in merge
2026-04-29 06:29:56 +08:00

42 lines
1.5 KiB
Python

"""Tests for astrbot.core.pipeline.context module."""
from dataclasses import dataclass
from unittest.mock import MagicMock
import pytest
from astrbot.core.pipeline import context as pipeline_context_module
from astrbot.core.pipeline.context import PipelineContext
from astrbot.core.pipeline.context_utils import call_event_hook, call_handler
class TestPipelineContext:
"""Smoke tests for PipelineContext."""
def test_module_import(self):
"""Verify the context module can be imported."""
import astrbot.core.pipeline.context # noqa: F811
assert hasattr(
astrbot.core.pipeline.context,
"PipelineContext",
)
def test_class_is_dataclass(self):
"""Verify PipelineContext is a dataclass."""
assert hasattr(PipelineContext, "__dataclass_fields__")
def test_class_fields(self):
"""Verify PipelineContext has the expected fields."""
fields = {f.name for f in PipelineContext.__dataclass_fields__.values()}
assert "astrbot_config" in fields
assert "plugin_manager" in fields
assert "astrbot_config_id" in fields
def test_call_handler_is_referenced(self):
"""Verify PipelineContext references call_handler."""
assert PipelineContext.call_handler is call_handler
def test_call_event_hook_is_referenced(self):
"""Verify PipelineContext references call_event_hook."""
assert PipelineContext.call_event_hook is call_event_hook