Files
qwenpaw/tests/integration/test_channels_manager_module.py
agent-radar 1a3a4ccde1
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:01:50 +08:00

119 lines
3.5 KiB
Python

# -*- coding: utf-8 -*-
"""Integration tests for channels manager + chats utils internals.
Covers src/qwenpaw/app/channels/manager.py and
src/qwenpaw/app/chats/utils.py (Channels + Chat modules, several
thousand uncovered lines).
"""
from __future__ import annotations
import pytest
# ------------------------------------------------------------------ #
# ChannelManager
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_channel_manager_empty() -> None:
"""ChannelManager constructs with an empty channel list."""
from qwenpaw.app.channels.manager import ChannelManager
manager = ChannelManager(channels=[])
assert manager is not None
@pytest.mark.integration
@pytest.mark.p1
def test_channel_manager_get_channel_missing() -> None:
"""get_channel returns None for an unknown channel id."""
import asyncio
from qwenpaw.app.channels.manager import ChannelManager
manager = ChannelManager(channels=[])
result = asyncio.run(manager.get_channel("integ-unknown"))
assert result is None
# ------------------------------------------------------------------ #
# chats utils: text cleaning
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_strip_injected_skill_block() -> None:
"""strip_injected_skill_block removes injected skill markers."""
from qwenpaw.app.chats.utils import strip_injected_skill_block
text = "hello <skill>injected</skill> world"
cleaned = strip_injected_skill_block(text, "assistant")
assert isinstance(cleaned, str)
@pytest.mark.integration
@pytest.mark.p1
def test_clean_display_text_passthrough() -> None:
"""clean_display_text returns plain text unchanged."""
from qwenpaw.app.chats.utils import clean_display_text
assert clean_display_text("plain text", "assistant") == "plain text"
# ------------------------------------------------------------------ #
# chats utils: url helpers
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_is_local_file_url() -> None:
"""_is_local_file_url distinguishes local file URLs."""
from qwenpaw.app.chats.utils import _is_local_file_url
assert _is_local_file_url("file:///tmp/x.png") is True
assert _is_local_file_url("https://example.com/x.png") is False
@pytest.mark.integration
@pytest.mark.p1
def test_abspath_from_url() -> None:
"""_abspath_from_url extracts the path from a file URL."""
from qwenpaw.app.chats.utils import _abspath_from_url
assert _abspath_from_url("file:///tmp/x.png") == "/tmp/x.png"
# ------------------------------------------------------------------ #
# chats utils: timestamp normalization
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_normalize_msg_timestamp() -> None:
"""_normalize_msg_timestamp converts to the user timezone."""
from zoneinfo import ZoneInfo
from qwenpaw.app.chats.utils import _normalize_msg_timestamp
normalized = _normalize_msg_timestamp(
"2026-08-26T00:00:00Z",
ZoneInfo("Asia/Shanghai"),
)
assert isinstance(normalized, str)
assert "+08:00" in normalized or "08:00" in normalized
@pytest.mark.integration
@pytest.mark.p1
def test_process_local_tz() -> None:
"""_process_local_tz returns a tzinfo."""
from qwenpaw.app.chats.utils import _process_local_tz
assert _process_local_tz() is not None