repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
QwenPaw | tests/unit/agents/context/test_unsandboxed_gate.py | .py | # -*- coding: utf-8 -*-
"""The unsandboxed-recall escape hatch is gated by deployment, not agent.json.
Running recall without a sandbox executes model-authored Python as the agent
user. ``scroll_unsandboxed_allowed`` must require BOTH the per-agent config
flag AND the deployment-layer ``QWENPAW_ALLOW_UNSANDBOXED_RECAL... | 50 | 1,694 |
QwenPaw | tests/unit/agents/context/test_memoryspace.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access,unused-argument
"""Unit tests for :class:`MemorySpace` — the model's SQLite recall surface.
The security-critical guarantee is that the model, which runs arbitrary SQL
here, cannot escape the read-only attach of durable history. These test... | 2,012 | 59,827 |
QwenPaw | tests/unit/agents/context/test_agent_resume.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access,unused-argument
"""Agent-level resume / crash-recovery tests for the scroll strategy.
These drive the REAL ``QwenPawAgent.state_dict`` / ``load_state_dict`` wiring
(not the manager in isolation): after an agent process dies mid-session and... | 196 | 7,056 |
QwenPaw | tests/unit/agents/context/test_scroll_first_run.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=too-few-public-methods,protected-access
"""The scroll first-run notice.
Scroll became the DEFAULT context strategy, so agents that never set
``strategy`` are switched to it silently and get a durable ``history.db`` in
their workspace. ``build_scroll_components`` must log a one... | 166 | 5,400 |
QwenPaw | tests/unit/agents/context/test_search_sanitize.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""ms.search() must never crash on raw user/model text.
FTS5 MATCH takes a query grammar, not plain text, so queries like ``C++`` or
``foo-bar`` would raise sqlite3.OperationalError. fts_match_query() rewrites
them into a safe expression (... | 105 | 3,385 |
QwenPaw | tests/unit/agents/context/test_recall_tool.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""Unit tests for the structured ``recall_history`` tool.
The point of this tool is that the common recall ops (expand / search /
recall_tool) run in-process with bound parameters — no sandbox, no approval —
so fold stubs and the eviction ... | 1,201 | 34,762 |
QwenPaw | tests/unit/agents/utils/test_tool_message_utils.py | .py | # -*- coding: utf-8 -*-
"""Tests for tool_message_utils — pure logic functions.
Covers:
- extract_tool_ids
- check_valid_messages
- _remove_invalid_tool_blocks
- _dedup_tool_blocks
- _repair_empty_tool_inputs
- _truncate_text
- _sanitize_tool_messages (orchestrator)
"""
# pylint: disable=redefined-outer-name
import js... | 692 | 22,404 |
QwenPaw | tests/unit/agents/utils/test_as_msg_handler.py | .py | # -*- coding: utf-8 -*-
"""Tests for AsMsgHandler media token estimates."""
# pylint: disable=protected-access
import base64
import pytest
from agentscope.message import (
Base64Source,
DataBlock,
Msg,
)
from qwenpaw.agents.utils.as_msg_handler import AsMsgHandler
from qwenpaw.agents.utils.estimate_toke... | 110 | 3,216 |
QwenPaw | tests/unit/agents/utils/test_estimate_token_counter.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.agents.utils.estimate_token_counter."""
# pylint: disable=protected-access
import pytest
from qwenpaw.agents.utils.estimate_token_counter import (
EstimatedTokenCounter,
)
class TestEstimatedTokenCounterInit:
"""Tests for EstimatedTokenCounter.__init__."""
d... | 78 | 2,549 |
QwenPaw | tests/unit/agents/utils/test_audio_transcription.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.agents.utils.audio_transcription.
Covers:
- _url_for_provider
- _get_manager
- list_transcription_providers
- get_configured_transcription_provider_id
- check_local_whisper_available
- _get_configured_provider_creds
- _transcribe_local_whisper
- _transcribe_whisper_api
- tr... | 489 | 16,295 |
QwenPaw | tests/unit/agents/utils/test_setup_utils.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.agents.utils.setup_utils.
Covers:
- normalize_agent_language
- _resolve_md_lang_dir
- _template_fallback_language_order
- _copy_template_md_files
- _remove_bootstrap_from_workspace
- copy_template_md_files
- copy_workspace_md_files
- copy_builtin_qa_md_files
"""
# pylint: d... | 253 | 8,090 |
QwenPaw | tests/unit/agents/utils/test_message_processing.py | .py | # -*- coding: utf-8 -*-
"""Tests for message_processing utils.
Covers:
- is_first_user_interaction
- prepend_to_message_content
"""
# pylint: disable=redefined-outer-name
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from agentscope.message import (
Base64Source,
DataBlock,
Msg,
... | 308 | 9,943 |
QwenPaw | tests/unit/agents/utils/test_file_handling.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.agents.utils.file_handling.
Covers:
- read_text_file_with_encoding_fallback
- _default_download_dir
- _resolve_local_path
- _guess_suffix_from_file_content
- download_file_from_base64
- download_file_from_url
"""
# pylint: disable=protected-access,unused-argument
import os... | 265 | 8,794 |
QwenPaw | tests/unit/agents/utils/test_media_token_estimate.py | .py | # -*- coding: utf-8 -*-
"""Tests for inlined media token estimates."""
# pylint: disable=protected-access
from __future__ import annotations
import base64
import io
import math
import wave
from PIL import Image
from qwenpaw.agents.utils import media_token_estimate as mte
from qwenpaw.agents.utils.media_token_estim... | 136 | 4,196 |
QwenPaw | tests/unit/agents/memory/test_reme_config.py | .py | # -*- coding: utf-8 -*-
"""Tests for embedded ReMe configuration mapping."""
from qwenpaw.agents.memory.reme_config import get_reme_app_config
from qwenpaw.config.config import (
AgentProfileConfig,
AgentsRunningConfig,
EmbeddingModelConfig,
ReMeLightMemoryConfig,
)
def _config_for_embedding(embeddin... | 230 | 7,046 |
QwenPaw | tests/unit/agents/memory/test_reme_daily_paper.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Focused tests for the embedded ReMe Daily Paper entry point."""
import asyncio
from types import SimpleNamespace
from unittest.mock import AsyncMock, patch
import pytest
from qwenpaw.agents.memory.reme_light_memory_manager import (
ReMeLightMemoryMana... | 251 | 8,075 |
QwenPaw | tests/unit/agents/memory/test_adbpg_memory_manager.py | .py | # -*- coding: utf-8 -*-
"""Tests for ADBPG memory manager behavior."""
# pylint: disable=protected-access
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from agentscope.message import Msg, TextBlock, ToolResultState
from agentscope.tool import ToolChunk
from qwenpaw.agents.memory... | 95 | 2,936 |
QwenPaw | tests/unit/agents/memory/test_reme_embedding_update.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Tests for ReMe embedding object hot updates."""
import asyncio
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import AsyncMock, patch
import pytest
from qwenpaw.agents.memory.embedding_model import (
embedding_config_fin... | 287 | 9,180 |
QwenPaw | tests/unit/agents/memory/test_agent_md_manager.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""Tests for AgentMdManager."""
from pathlib import Path
from unittest.mock import patch
import pytest
# agent_md_manager.py has no third-party deps — no sys.modules mocks needed
# -------------------------------------------------------... | 421 | 15,180 |
QwenPaw | tests/unit/agents/memory/test_base_memory_manager.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access,unused-argument
"""Tests for BaseMemoryManager abstract base class."""
import asyncio
from types import SimpleNamespace
from unittest.mock import MagicMock
import pytest
from agentscope.message import Msg, TextBlock
from qwenpaw.agents.m... | 507 | 16,315 |
QwenPaw | tests/unit/agents/memory/test_embedding_model.py | .py | # -*- coding: utf-8 -*-
"""Tests for AgentScope embedding model construction and probing."""
from types import SimpleNamespace
import pytest
from qwenpaw.agents.memory import embedding_model as module
from qwenpaw.config.config import EmbeddingModelConfig
def _config(**overrides) -> EmbeddingModelConfig:
value... | 102 | 2,825 |
QwenPaw | tests/unit/app/test_multi_agent_manager_startup.py | .py | # -*- coding: utf-8 -*-
"""Tests for bounded multi-agent startup scheduling."""
# pylint: disable=protected-access
from __future__ import annotations
import asyncio
import os
import subprocess
import sys
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock
import pytest
import qwenpaw.app... | 723 | 22,204 |
QwenPaw | tests/unit/app/test_agents_workspace_initialization.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Regression tests for agent workspace initialization."""
import json
from pathlib import Path
from types import SimpleNamespace
from qwenpaw.app.routers import agents as agents_router
def _stub_global_config(language: str = "en") -> SimpleNamespace:
r... | 92 | 2,432 |
QwenPaw | tests/unit/app/test_scroll_startup_io.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Regression tests for Scroll's startup-time synchronous I/O."""
from __future__ import annotations
import asyncio
import importlib
import threading
from pathlib import Path
import pytest
from qwenpaw.agents.context.scroll import sync as scroll_sync
from q... | 83 | 2,465 |
QwenPaw | tests/unit/app/test_agent_context_project_dir.py | .py | # -*- coding: utf-8 -*-
"""Tests for Files API project-directory request context."""
import asyncio
import time
from pathlib import Path
from types import SimpleNamespace
import pytest
from fastapi import HTTPException
from starlette.requests import Request
from qwenpaw.app.agent_context import get_project_dir_for_r... | 106 | 2,797 |
QwenPaw | tests/unit/app/test_agents_ordering.py | .py | # -*- coding: utf-8 -*-
"""Tests for persisted agent ordering."""
from types import SimpleNamespace
import pytest
from fastapi import HTTPException
from qwenpaw.config.config import (
AgentProfileConfig,
AgentProfileRef,
Config,
)
from qwenpaw.config.utils import load_config, save_config
from qwenpaw.app... | 323 | 9,882 |
QwenPaw | tests/unit/app/test_mcp_background_startup.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access,wrong-import-position,no-name-in-module
"""Tests for non-blocking MCP startup."""
from __future__ import annotations
import asyncio
from types import SimpleNamespace
import pytest
# pylint: disable=no-name-in-module
# flake8: noqa: E402,E501
pytest.importor... | 153 | 4,377 |
QwenPaw | tests/unit/app/test_task_tracker.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.task_tracker.TaskTracker``.
Covers:
- idle/running status before/after a task
- external task registration round-trip and idempotency
- attach() to non-existent / completed / live runs
- attach_or_start() reuses an in-flight run vs. starting a new one
- request_s... | 503 | 14,861 |
QwenPaw | tests/unit/app/test_backup_route_helpers.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import json
import zipfile
from qwenpaw.app.routers import _backup_helpers as helpers
from qwenpaw.app.routers._backup_helpers import restored_local_keys
from qwenpaw.backup._utils import constants
from qwenpaw.backup._utils.constants import META_FILE, PREFIX... | 90 | 2,661 |
QwenPaw | tests/unit/app/test_approval_scope.py | .py | # -*- coding: utf-8 -*-
"""UT for approval scope plumbing (EXACT vs SIMILAR).
Covers the new ``ApprovalScope`` enum, ``ApprovalService.resolve_request``
staking scope on the pending record, and ``approval_display_fields``
surfacing the console gating fields.
"""
from __future__ import annotations
# pylint: disable=pr... | 184 | 6,190 |
QwenPaw | tests/unit/app/conftest.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
from __future__ import annotations
from datetime import datetime, timezone as _tz
from typing import Optional
from unittest.mock import AsyncMock, MagicMock
import pytest
from qwenpaw.app.crons.manager import CronManager
from qwenpaw.app.crons.models imp... | 168 | 4,386 |
QwenPaw | tests/unit/app/workspace/test_bootstrap_factory.py | .py | # -*- coding: utf-8 -*-
"""Tests for WorkspaceBootstrapFactory."""
from __future__ import annotations
from qwenpaw.app.workspace.bootstrap_factory import WorkspaceBootstrapFactory
class TestWorkspaceBootstrapFactory:
"""Verify shared bootstrap factory produces correct kwargs."""
def test_build_bootstrap_kwa... | 62 | 2,403 |
QwenPaw | tests/unit/app/crons/test_executor.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
from unittest.mock import AsyncMock
import pytest
from qwenpaw.app.crons.executor import CronExecutor
from qwenpaw.app.crons.models import DispatchSpec, DispatchTarget
from qwenpaw.schemas import Event, RunStatus
from tests.unit.app.conftest import make_cron... | 168 | 5,088 |
QwenPaw | tests/unit/app/crons/test_manager.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""Unit tests for CronManager.
Covers: lifecycle, CRUD, state cleanup, concurrent write serialization,
and manager-level tolerance for failed job registration during start.
Note: the tests here exercise CronManager behavior only. They do ... | 454 | 13,097 |
QwenPaw | tests/unit/app/crons/test_models.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import pytest
from pydantic import ValidationError
from qwenpaw.app.crons.models import (
CronJobSpec,
DispatchSpec,
DispatchTarget,
ScheduleSpec,
_crontab_dow_to_name,
)
from tests.unit.app.conftest import make_cron_job_spec
# ---------... | 146 | 4,211 |
QwenPaw | tests/unit/app/crons/test_heartbeat.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
from qwenpaw.app.crons.heartbeat import (
_extract_message_preview,
is_cron_expression,
parse_heartbeat_every,
)
# ---------------------------------------------------------------------------
# is_cron_expression
# --------------------------------... | 110 | 3,163 |
QwenPaw | tests/unit/app/crons/test_json_repo.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
from __future__ import annotations
import json
from pathlib import Path
import pytest
from qwenpaw.app.crons.repo.json_repo import (
JsonJobRepository,
migrate_final_mode_to_stream,
migrate_legacy_weixin_jobs_file,
)
from qwenpaw.app.crons.mo... | 245 | 7,295 |
QwenPaw | tests/unit/app/routers/test_config_router.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.routers.config``.
Scope: representative subset of the config router as called out in the
acceptance criteria — GET / PUT happy paths, 404 / 422 validation
errors. Covers:
- ``GET /config/channels/types`` — pure list
- ``GET /config/channels`` — happy path throu... | 752 | 22,467 |
QwenPaw | tests/unit/app/routers/test_agents_router.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.routers.agents``.
Covers the highest-value flows:
- ``GET /agents`` — list all agents
- ``GET /agents/{id}`` — fetch single agent, 404 on missing
- ``PUT /agents/order`` — reject duplicate or mismatched IDs (400)
- ``DELETE /agents/{id}`` — refuse to delete ``de... | 1,314 | 38,138 |
QwenPaw | tests/unit/app/routers/test_workspace_router.py | .py | # -*- coding: utf-8 -*-
"""Focused unit tests for workspace running-config update ordering."""
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from fastapi import HTTPException
from qwenpaw.app.routers.workspace import (
_ConfigRollbackConflict,
_conditio... | 562 | 18,177 |
QwenPaw | tests/unit/app/routers/test_workspace_files_router.py | .py | # -*- coding: utf-8 -*-
"""API tests for the unified Files workspace contract."""
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from watchfiles import Change
from qwenpaw.app.routers i... | 386 | 11,446 |
QwenPaw | tests/unit/app/routers/test_messages_router.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.routers.messages``.
These tests use FastAPI's ``TestClient`` against a synthetic app whose
``app.state.multi_agent_manager`` is a MagicMock — the shared mocks
come from ``conftest.py``; the messages-only ``app`` fixture lives
here so other ``test_xxx_router.py`` ... | 200 | 6,091 |
QwenPaw | tests/unit/app/routers/test_console_chat_reconnect.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for the ``POST /console/chat`` reconnect branch.
When a client reconnects to a chat whose run already finished (the
tracker cleaned it up between the status poll and the reconnect), the
endpoint must answer with an immediately-terminated SSE stream so the
client's stream reader co... | 181 | 5,635 |
QwenPaw | tests/unit/app/routers/test_console_chat_task.py | .py | # -*- coding: utf-8 -*-
"""Regression tests for background console task completion."""
# pylint: disable=protected-access,unused-argument
from __future__ import annotations
import asyncio
import json
import stat
import subprocess
from dataclasses import dataclass
from pathlib import Path
from types import SimpleNamesp... | 357 | 10,824 |
QwenPaw | tests/unit/app/routers/test_harnesses_router.py | .py | # -*- coding: utf-8 -*-
"""Tests for third-party agent authentication routes."""
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
from typing import Awaitable, Callable, cast
from unittest.mock import AsyncMock
import pytest
from fastapi import HTTPException, Request
fro... | 128 | 3,840 |
QwenPaw | tests/unit/app/routers/test_healthz.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``GET /api/healthz``."""
# pylint: disable=redefined-outer-name
from __future__ import annotations
import asyncio
import time
from unittest.mock import MagicMock
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from qwenpaw.app.routers.heal... | 79 | 2,229 |
QwenPaw | tests/unit/app/routers/test_provider_rename.py | .py | # -*- coding: utf-8 -*-
"""Tests for renaming custom providers via the config endpoint."""
from types import SimpleNamespace
from qwenpaw.app.routers.providers import (
ProviderConfigRequest,
configure_provider,
)
class FakeManager:
"""Records update_provider calls for assertion."""
def __init__(se... | 70 | 1,842 |
QwenPaw | tests/unit/app/routers/test_pawapps_build_info.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for PawApp listing metadata contract."""
from __future__ import annotations
import json
from pathlib import Path
from qwenpaw.app.routers.pawapps import _build_app_info
CREATOR_PLUGIN_JSON = (
Path(__file__).resolve().parents[4]
/ "plugins"
/ "apps"
/ "qwenpaw-cr... | 66 | 1,973 |
QwenPaw | tests/unit/app/routers/test_provider_oauth_router.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for provider OAuth router registration."""
from __future__ import annotations
from fastapi import FastAPI
from fastapi.testclient import TestClient
from qwenpaw.app.routers import router as api_router
def test_openrouter_oauth_start_is_registered() -> None:
"""POST /api/pr... | 25 | 765 |
QwenPaw | tests/unit/app/routers/test_provider_context_window.py | .py | # -*- coding: utf-8 -*-
"""Tests for active-model context-window metadata."""
from types import SimpleNamespace
from qwenpaw.app.routers.providers import _active_models_info
from qwenpaw.config.config import ModelSlotConfig
def test_active_models_info_uses_runtime_context_resolution():
provider = SimpleNamespac... | 19 | 654 |
QwenPaw | tests/unit/app/routers/test_skills_router.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.routers.skills``.
Per the issue acceptance criteria the focus is on:
- ``GET /skills`` — list workspace skills
- ``GET /skills/hub/search`` — hub search wrapper
- ``GET /skills/pool`` — pool listing
- Hub install task lifecycle: start → status → cancel
- ``GET /... | 250 | 7,704 |
QwenPaw | tests/unit/app/routers/test_checkpoints_router.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
import pytest
from fastapi import HTTPException
from qwenpaw.app.routers import checkpoints as router
from qwenpaw.checkpoints.models import CheckpointEntry, GcResult, RestoreResult
from qwenpaw.chec... | 271 | 7,939 |
QwenPaw | tests/unit/app/routers/test_loops_router.py | .py | # -*- coding: utf-8 -*-
"""Tests for custom loop mode persistence endpoints."""
# pylint: disable=redefined-outer-name
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from fastapi import FastAPI
from fastapi.testclient import Tes... | 431 | 12,475 |
QwenPaw | tests/unit/app/routers/test_tool_calls_router.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.routers.tool_calls`` session scoping."""
# pylint: disable=redefined-outer-name
from __future__ import annotations
import asyncio
from types import SimpleNamespace
from unittest.mock import MagicMock
import pytest
from fastapi import FastAPI
from fastapi.testcli... | 87 | 2,632 |
QwenPaw | tests/unit/app/routers/conftest.py | .py | # -*- coding: utf-8 -*-
"""Shared fixtures for ``tests/unit/app/routers/``.
Only truly shared building blocks live here: the ``workspace_mock`` /
``manager_mock`` mocks that every router test will want. Each
``test_xxx_router.py`` builds its own ``app`` fixture mounting just the
router under test — keeping that local ... | 34 | 1,216 |
QwenPaw | tests/unit/app/auth/test_client_ip.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for the auth bypass fix (NVDB-TEMP-CAIVD-2026671557).
Validates that _resolve_client_ip and _should_skip_auth correctly handle
trusted proxy verification and XFF right-to-left parsing.
"""
from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytes... | 267 | 9,856 |
QwenPaw | tests/unit/app/inbox/test_inbox_trace_store.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access,unused-argument
# pylint: disable=use-implicit-booleaness-not-comparison
"""Unit tests for qwenpaw.app.inbox_trace_store.
Real file IO through a monkeypatched ``_TRACE_DIR`` — no over-mocking.
Covers: create_trace, append_trace_events (nor... | 566 | 18,455 |
QwenPaw | tests/unit/app/inbox/test_inbox_store.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access,unused-argument
"""Unit tests for qwenpaw.app.inbox_store.
Real file IO through a monkeypatched ``_INBOX_PATH`` -- no over-mocking.
Covers: append_event, list_events filters/pagination, mark_read,
mark_all_read, delete_event (incl. run_id ... | 448 | 13,676 |
QwenPaw | tests/unit/app/chats/test_manager.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.chats.manager.ChatManager``.
Uses the real :class:`JsonChatRepository` backed by ``tmp_path`` so the
tests cover the integrated CRUD path without mocking the repo away.
"""
# pylint: disable=protected-access,redefined-outer-name,unused-argument
from __future__ im... | 419 | 11,946 |
QwenPaw | tests/unit/app/chats/test_models.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import pytest
from pydantic import ValidationError
from qwenpaw.app.chats.models import (
ChatSpec,
ChatUpdate,
ChatsFile,
SessionSource,
)
# ---------------------------------------------------------------------------
# SessionSource enum
# ... | 98 | 2,741 |
QwenPaw | tests/unit/app/chats/test_session.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``qwenpaw.app.chats.session``.
Covers:
- ``_safe_json_loads`` recovery from corrupted JSON
- ``sanitize_filename`` Windows-illegal-character replacement
- ``SafeJSONSession`` save / load / update / get round-trip
- ``SafeJSONSession`` cross-channel migration helper
- ``migrate... | 451 | 14,022 |
QwenPaw | tests/unit/app/chats/test_repo.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
from __future__ import annotations
import json
from pathlib import Path
import pytest
from qwenpaw.app.chats.models import ChatSpec, ChatsFile
from qwenpaw.app.chats.repo.json_repo import (
JsonChatRepository,
migrate_legacy_weixin_chats_file,
)
... | 139 | 3,836 |
QwenPaw | tests/unit/app/chats/test_utils.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
from datetime import datetime
from types import SimpleNamespace
from unittest.mock import patch
from zoneinfo import ZoneInfo
from agentscope.message import Msg
from qwenpaw.app.chats.utils import (
_abspath_from_url,
_is_local_file_url,
_normali... | 434 | 13,551 |
QwenPaw | tests/unit/app/channels/test_command_registry.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for qwenpaw.app.channels.command_registry."""
from __future__ import annotations
# pylint: disable=protected-access,redefined-outer-name,unused-argument,use-implicit-booleaness-not-comparison,unused-import # noqa: E501
import pytest
from qwenpaw.app.channels.command_registry i... | 244 | 9,182 |
QwenPaw | tests/unit/app/channels/test_access_control.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for qwenpaw.app.channels.access_control."""
from __future__ import annotations
# pylint: disable=protected-access,redefined-outer-name,unused-argument,use-implicit-booleaness-not-comparison,unused-import # noqa: E501
import json
import time
from pathlib import Path
import pyte... | 389 | 13,850 |
QwenPaw | tests/unit/app/channels/test_unified_queue_manager.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for qwenpaw.app.channels.unified_queue_manager."""
from __future__ import annotations
# pylint: disable=protected-access,redefined-outer-name,unused-argument,use-implicit-booleaness-not-comparison,unused-import # noqa: E501
import asyncio
import time
from typing import Any
imp... | 341 | 11,826 |
QwenPaw | tests/unit/app/channels/test_conflict.py | .py | # -*- coding: utf-8 -*-
"""Tests for channel Bot identity extraction."""
from types import SimpleNamespace
import pytest
from qwenpaw.app.channels.conflict import get_channel_bot_identity
@pytest.mark.parametrize(
("channel_name", "config", "expected"),
[
(
"telegram",
{"bot... | 63 | 1,693 |
QwenPaw | tests/unit/app/channels/test_renderer.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for qwenpaw.app.channels.renderer + streaming chunk splitting.
Covers:
- RenderStyle configuration & MessageRenderer.message_to_parts
- parts_to_text merging (text + media fallback)
- Streaming chunk splitting behavior (historical issue:
multi-segment streaming merged → fixed vi... | 734 | 24,058 |
QwenPaw | tests/unit/app/channels/test_console_channel.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for qwenpaw.app.channels.console.channel.ConsoleChannel.
Focuses on the *local* ConsoleChannel helpers (start/stop/send, session
resolution, parts rendering). Heavy streaming pipeline behavior is covered
elsewhere; here we exercise pure helpers and async lifecycle methods.
"""
fr... | 312 | 10,471 |
QwenPaw | tests/unit/app/channels/test_schema.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for qwenpaw.app.channels.schema."""
from __future__ import annotations
# pylint: disable=protected-access,redefined-outer-name,unused-argument,use-implicit-booleaness-not-comparison,unused-import # noqa: E501
import pytest
from qwenpaw.app.channels.schema import (
BUILTIN_... | 124 | 3,764 |
QwenPaw | tests/unit/app/approvals/test_service.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``ApprovalService``.
Covers the full approval lifecycle (create → resolve / cancel / timeout /
GC) and the cross-session / cross-agent scoping rules that prevent an
approval issued for one conversation tree from leaking into another.
Scope plumbing (EXACT vs SIMILAR) is exerc... | 554 | 18,640 |
QwenPaw | tests/unit/app/approvals/test_display.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for :mod:`qwenpaw.app.approvals.display`.
The scope-gating fields (``exact_target`` / ``similar_target`` /
``is_generalized``) are already pinned in
``tests/unit/app/test_approval_scope.py``. This file covers the
remaining branches of ``approval_display_fields``: non-dict ``displ... | 108 | 3,766 |
QwenPaw | tests/unit/app/approvals/test_models.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for :mod:`qwenpaw.app.approvals.models`.
The module is tiny but it ships the data contract that every approval
source (ToolGuard, driver policy, IM channels, …) feeds into the central
``ApprovalService``. We pin field names, defaults and immutability so a
downstream refactor cann... | 106 | 3,627 |
QwenPaw | tests/unit/app/approvals/test_driver_gate.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for the driver approval gate.
The gate bridges a Driver policy ``ask`` outcome into the central
``ApprovalService`` Future flow. These tests exercise the allow path, the
deny path, the missing-session-id guard and the stale-pending eviction
that fires when a Driver replays the sa... | 264 | 8,468 |
QwenPaw | tests/fixtures/mcp/stdio_echo_server.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import os
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("qwenpaw-stdio-echo")
@mcp.tool()
def echo(text: str) -> str:
return text
@mcp.tool()
def get_secret_status() -> dict[str, bool]:
return {"has_secret": bool(os.environ.get("ECHO_SECRE... | 23 | 369 |
QwenPaw | tests/fixtures/mcp/oauth_fake_server.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qs, urlencode, urlparse
class OAuthHandler(BaseHTTPRequestHandler):
def do_GET(self) -> None: # noqa: N802
parsed = urlparse(self.path)
... | 45 | 1,505 |
QwenPaw | tests/fixtures/mcp/http_echo_server.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("qwenpaw-http-echo")
@mcp.tool()
def echo_http(text: str) -> str:
return text
@mcp.tool()
def inspect_headers() -> dict[str, str]:
# FastMCP tool functions do not receive raw HTTP headers direct... | 23 | 537 |
QwenPaw | tests/fixtures/channels/mock_http.py | .py | # -*- coding: utf-8 -*-
"""
HTTP Mock Utilities for Channel Testing
Provides tools for mocking HTTP requests in channel tests.
"""
from __future__ import annotations
from contextlib import asynccontextmanager
from typing import Dict, List, Optional
class MockAiohttpResponse:
"""Mock aiohttp ClientResponse."""
... | 237 | 7,178 |
QwenPaw | tests/e2e/conftest.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import pytest
@pytest.fixture(autouse=True)
def fake_driver_secret_store(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(
"qwenpaw.drivers.credentials.store.encrypt",
lambda value: f"ENC:{value}",
)
monkeypatch.setat... | 21 | 597 |
QwenPaw | scripts/gen_browser_manual.py | .py | # -*- coding: utf-8 -*-
"""Materialize the Browser SDK reference into packaged skill marker blocks."""
from pathlib import Path
from qwenpaw.browser.sdk.facade import _build_manual_text
BEGIN = "<!-- BEGIN GENERATED: browser-manual -->"
END = "<!-- END GENERATED: browser-manual -->"
ROOT = Path(__file__).resolve().... | 39 | 1,166 |
QwenPaw | scripts/check_channel_contracts.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Check that all Channel subclasses have Contract test coverage.
Usage:
python scripts/check_channel_contracts.py
Notes:
- Static scan, no dependencies required (including pytest)
- Compares Channel classes in src/ with test files in tests/contract/
CI Int... | 107 | 3,128 |
QwenPaw | scripts/cleanup_windows_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Cleanup script: removes all QwenPaw sandbox ACLs, profiles, users, and state.
Run on Windows:
python scripts/cleanup_windows_sandbox.py
Administrator privileges are required for elevated sandbox cleanup (user
accounts, firewall rules, profile directories). Unelevated and AppContainer
s... | 1,050 | 37,504 |
QwenPaw | scripts/run_tests.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Local test runner script for QwenPaw project.
Usage:
python scripts/run_tests.py [OPTIONS]
Options:
-u, --unit [DIR] Run unit tests (optionally specify subdirectory)
-i, --integrated Run integrated tests
-a, --all Run all tests (... | 282 | 7,719 |
QwenPaw | scripts/verify/desktop_verify.py | .py | # -*- coding: utf-8 -*-
"""Desktop release verification script.
Drives a running QwenPaw desktop backend (either Tauri packaging flavour:
tauri-win / tauri-mac) end-to-end:
1. ``GET /api/version`` — health + version match.
2. ``GET /`` — frontend HTML served.
3. ``PUT /api/models/<provider>/config`` ... | 983 | 34,878 |
QwenPaw | scripts/pack-tauri/stage_python_runtime.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Stage a standalone CPython runtime for the Tauri desktop bundle.
The Tauri backend is a PyInstaller-frozen executable, so ``sys.executable`` is
not a usable Python interpreter. To install third-party *plugin* dependencies
at runtime we ship a standalone CPython (python... | 249 | 8,008 |
QwenPaw | scripts/pack-tauri/generate_update_manifest.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tauri updater helper: stage per-platform artifacts and build the manifest.
Subcommands:
stage Copy a Tauri-built updater archive (and its .sig) into the dist
tree, then write a small JSON sidecar describing it.
manifest Aggregate one or more stage-... | 299 | 9,807 |
QwenPaw | scripts/pack-tauri/stage_node_runtime.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Stage a Node.js runtime for the Tauri desktop bundle."""
from __future__ import annotations
import argparse
import os
import platform
import shutil
import tarfile
import tempfile
import urllib.request
import zipfile
from pathlib import Path
DEFAULT_NODE_VERSION = "v22... | 142 | 4,216 |
QwenPaw | scripts/startup_profile/tracer.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Function execution tracer for QwenPaw."""
import json
import time
import traceback
from collections import defaultdict
class ExecTracer:
"""Trace function execution in qwenpaw package."""
def __init__(self, package_names=None):
"""Initialize tracer.
... | 224 | 7,810 |
QwenPaw | scripts/startup_profile/analyze.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
QwenPaw Startup Performance Analyzer
Collects startup performance data and outputs JSON for visualization.
"""
import json
import re
import subprocess
import sys
import time
from datetime import datetime
from pathlib import Path
def collect_import_time(output_dir):
... | 323 | 8,887 |
QwenPaw | scripts/pack/generate_oss_metadata.py | .py | #!/usr/bin/env python3
"""
Generate OSS metadata JSON files for release artifacts.
Usage:
python generate_oss_metadata.py \
--file dist/QwenPaw-Setup-1.0.0.exe \
--product desktop \
--platform win \
--version 1.0.0 \
--output metadata.json
"""
import argparse
import hashlib
import json
import os... | 219 | 6,528 |
QwenPaw | scripts/pack/generate_plugin_metadata.py | .py | #!/usr/bin/env python3
"""Scan local plugins, build distributable zips, and emit OSS metadata.
Mirrors the shape of ``generate_oss_metadata.py`` so the resulting
``metadata/plugins/index.json`` is a drop-in product entry for the existing
Downloads page (it iterates ``mainIndex.products`` regardless of product type).
... | 565 | 17,923 |
QwenPaw | scripts/pack/patch_main_index.py | .py | #!/usr/bin/env python3
"""Patch the main OSS metadata index to advertise the plugins product.
Ensures the top-level ``metadata/index.json`` has a ``products.plugins``
entry pointing to the plugins sub-index.
Usage::
python scripts/pack/patch_main_index.py \
--index main-index.json \
--out main-... | 62 | 1,603 |
QwenPaw | scripts/pack/build_common.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint:disable=too-many-statements
"""
Create a temporary conda env, install QwenPaw from a wheel, run conda-pack.
Used by build_macos.sh and build_win.ps1. Run from repo root.
"""
from __future__ import annotations
import argparse
import os
import random
import string
... | 252 | 7,532 |
QwenPaw | scripts/pack/merge_plugin_index.py | .py | #!/usr/bin/env python3
"""Merge a newly built plugin index with a historical one from OSS.
Used by the ``plugins-release.yml`` workflow to preserve old plugin
versions on the CDN while adding new ones.
Merge rules:
- ``files``: keyed by file_id (``{plugin_id}-{version}``). New entries
overwrite same-id old entries... | 125 | 3,767 |
QwenPaw | scripts/github/real_behavior_proof_policy.py | .py | # -*- coding: utf-8 -*-
"""Real behavior proof policy for QwenPaw PR checks.
Ported from openclaw's ``real-behavior-proof-policy.mjs``. Parses a PR
body and determines whether an **external contributor** has provided the
two required sections:
1. **What Problem This Solves** — a concrete user/product/operational
p... | 268 | 8,878 |
QwenPaw | scripts/github/real_behavior_proof_check.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position
"""CI check entry point: evaluate real-behavior-proof for the current PR.
Reads PR metadata from the GitHub Actions event payload, runs the policy
check, and exits non-zero if the PR is missing required context/evidence.
Environmen... | 105 | 3,409 |
QwenPaw | scripts/review-bot/setup_review_workspace.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Setup QwenPaw workspace for the AI Review Bot.
Runs after `qwenpaw init --defaults --accept-security` to customize
the agent identity for code review tasks and configure the LLM provider.
"""
import asyncio
import os
import sys
from pathlib import Path
REVIEW_PROVIDER... | 429 | 13,644 |
QwenPaw | scripts/review-bot/review_runner.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""QwenPaw AI Review Bot - Main runner script.
This script runs inside GitHub Actions to:
1. Read PR number and repo from environment variables
2. Send a task prompt to the local QwenPaw instance
3. QwenPaw autonomously fetches PR data via `gh` CLI
4. Parse the response a... | 1,155 | 40,908 |
QwenPaw | scripts/review-bot/prompts.py | .py | # -*- coding: utf-8 -*-
"""Review prompt templates for QwenPaw AI Review Bot (enhanced).
The review methodology, coding standards, and anti-pattern checklist
live in the workspace persona files (SOUL.md, AGENTS.md) written by
setup_review_workspace.py. This module builds the *task* prompt that
tells the agent which P... | 362 | 13,462 |
QwenPaw | plugins/apps/qwenpaw-creator/__init__.py | .py | # -*- coding: utf-8 -*-
"""QwenPaw Creator plugin."""
| 3 | 54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.