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/services/test_project_directory.py
.py
# -*- coding: utf-8 -*- """Tests for mode-independent project directory resolution.""" from pathlib import Path import pytest from qwenpaw.config.config import migrate_project_directory_config from qwenpaw.services.project_directory import ( resolve_effective_project_dir, session_project_dir, ) def test_re...
83
2,765
QwenPaw
tests/unit/observability/test_langfuse_integration.py
.py
# -*- coding: utf-8 -*- # pylint: disable=wrong-import-position """Tests for Langfuse observability integration components. Covers: - LangfuseTraceHook: trace scope opened in PRE_EXECUTE, skipped when disabled - LangfuseTraceCleanupHook: trace scope closed in FINALLY phase - LangfuseToolSpanMiddleware: tool observatio...
467
15,092
QwenPaw
tests/unit/observability/test_langfuse_context.py
.py
# -*- coding: utf-8 -*- # pylint: disable=wrong-import-position from contextlib import contextmanager import pytest # flake8: noqa: E402,E501 pytest.importorskip( "langfuse", reason="langfuse SDK required for observability tests", ) from qwenpaw.__version__ import __version__ from qwenpaw.observability impor...
244
7,170
QwenPaw
tests/unit/drivers/test_capabilities.py
.py
# -*- coding: utf-8 -*- """Tests for Driver capability-id encoding/decoding contracts.""" from __future__ import annotations import pytest from qwenpaw.drivers.capabilities import ( CapabilityExposure, DriverCapability, DriverInvocation, DriverInvocationResult, DriverRuntimeInfo, format_capabi...
133
4,255
QwenPaw
tests/unit/drivers/test_contracts.py
.py
# -*- coding: utf-8 -*- """Tests for DriverCard contract validation and credential coercion.""" from __future__ import annotations import pytest from qwenpaw.drivers.constants import CREDENTIAL_KIND_NONE from qwenpaw.drivers.contracts import ( CredentialRef, DriverCard, coerce_card, coerce_credential_...
359
12,593
QwenPaw
tests/unit/drivers/test_transient_scopes.py
.py
# -*- coding: utf-8 -*- """Tests for transient Driver scope isolation and lifecycle.""" from __future__ import annotations # Tests verify managed cleanup ownership directly. # pylint: disable=protected-access import asyncio from pathlib import Path from typing import ClassVar import pytest from qwenpaw.drivers.cap...
379
10,492
QwenPaw
tests/unit/drivers/test_policy_types.py
.py
# -*- coding: utf-8 -*- """Tests for Driver policy coercion and typed shape.""" from __future__ import annotations import pytest from qwenpaw.drivers.constants import ( POLICY_EFFECT_ALLOW, POLICY_EFFECT_ASK, POLICY_EFFECT_DENY, POLICY_TARGET_WILDCARD, ) from qwenpaw.drivers.errors import DriverCardEr...
164
5,783
QwenPaw
tests/unit/drivers/handlers/test_mcp_tool_name_sanitize.py
.py
# -*- coding: utf-8 -*- import re from types import SimpleNamespace import pytest from qwenpaw.drivers.capabilities import parse_capability_id from qwenpaw.drivers.handlers.mcp import ( _mcp_tool_to_capability, _sanitize_tool_name, _tool_namespace_from_display_name, ) @pytest.mark.parametrize( ("na...
160
4,719
QwenPaw
tests/unit/drivers/handlers/test_mcp_stateful_client.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Unit tests for the MCP stateful client lifecycle helpers. Intent ------ ``mcp_stateful_client`` runs its entire context-manager lifecycle in a single background task so enter/exit happen in the same asyncio task (see the module docstring — cross-task cancel...
535
17,013
QwenPaw
tests/unit/drivers/adapters/test_mcp_legacy_upgrade.py
.py
# -*- coding: utf-8 -*- """Tests for legacy MCP credential upgrade (self-heal of #6029 bad cards). Cards migrated *before* the #6029 fix stored ``${VAR}`` header values as literals in the credential store, so migration's "card already exists" gate never repairs them. ``upgrade_legacy_mcp_credentials`` re-runs the sam...
218
6,767
QwenPaw
tests/unit/drivers/adapters/test_mcp_legacy_env_ref.py
.py
# -*- coding: utf-8 -*- """Migration tests: legacy ${VAR} header/env values -> env: credential refs.""" from types import SimpleNamespace from qwenpaw.drivers.adapters.mcp_binding import ( EnvRefPlan, plan_env_ref_bindings, ) from qwenpaw.drivers.adapters.mcp_legacy_config import ( legacy_mcp_client_to_dri...
122
3,712
QwenPaw
tests/unit/drivers/adapters/test_env_ref.py
.py
# -*- coding: utf-8 -*- """Unit tests for ${VAR} env-reference parsing in legacy MCP migration.""" import pytest from qwenpaw.drivers.adapters.env_ref import ( EnvTemplate, env_alias, env_ref, parse_env_template, ) def test_single_reference_with_prefix_yields_format_placeholder() -> None: tpl = p...
57
1,627
QwenPaw
tests/unit/drivers/adapters/test_mcp_migration_version.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name """Versioned, one-shot MCP migration watermark (#6130). Before this change the startup migration used "does the DriverCard file exist?" as its "already migrated?" judgement. Deleting a migrated client (Console) removed the card but left the legacy ``agent...
194
6,850
QwenPaw
tests/unit/config/test_channel_display_migration.py
.py
# -*- coding: utf-8 -*- """Tests for the one-shot channel display migration.""" import json from threading import Lock from qwenpaw.config.config import ( AgentProfileConfig, AgentProfileRef, AgentsConfig, Config, load_agent_config, migrate_channel_display_fields, ) from qwenpaw.config import ...
113
3,522
QwenPaw
tests/unit/config/test_channel_shape_consistency.py
.py
# -*- coding: utf-8 -*- """Consistency guards for built-in channel shape declarations. A built-in channel is declared in more than one place, and those places must stay in sync. ``ChannelConfig`` is the source of truth for the config shape (this is what doctor already walks), while the registry and the API layer keep...
55
2,212
QwenPaw
tests/unit/config/test_memory_config.py
.py
# -*- coding: utf-8 -*- """Tests for memory backend configuration defaults.""" import pytest from pydantic import ValidationError from qwenpaw.config.config import ( ADBPGMemoryConfig, EmbeddingModelConfig, ReMeLightMemoryConfig, ) def test_adbpg_auto_memory_search_defaults(): cfg = ADBPGMemoryConfi...
113
3,254
QwenPaw
tests/unit/tunnel/test_binary_manager.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import hashlib import stat from pathlib import Path from unittest.mock import AsyncMock, MagicMock import pytest import qwenpaw.tunnel.binary_manager as bm_module from qwenpaw.tunnel.binary_manager import BinaryManager, _do...
157
4,911
QwenPaw
tests/unit/agent_stats/test_agent_token_usage.py
.py
# -*- coding: utf-8 -*- """Unit tests for current-agent token aggregation in AgentStatsService.""" from __future__ import annotations import json from datetime import date from pathlib import Path from unittest.mock import AsyncMock, patch import pytest from qwenpaw.agent_stats.models import AgentStatsSummary from ...
478
17,156
QwenPaw
tests/unit/utils/test_logging.py
.py
# -*- coding: utf-8 -*- """Unit tests for utils.logging (S级模块). S级: Core utilities with high risk of cascading failures. High coverage expected as this is stable infrastructure. """ from __future__ import annotations import logging import sys from unittest.mock import MagicMock, patch import pytest from qwenpaw.uti...
316
10,429
QwenPaw
tests/unit/utils/test_model_response.py
.py
# -*- coding: utf-8 -*- # pylint: disable=unused-argument """Tests for the shared chat-model response helpers.""" from types import SimpleNamespace import pytest from agentscope.model import ChatResponse from qwenpaw.utils.model_response import ( consume_model_response, extract_response_text, safe_attr, )...
93
2,530
QwenPaw
tests/unit/utils/test_command_runner.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import asyncio import os import subprocess from pathlib import Path from typing import Any import pytest from qwenpaw.utils import command_runner from qwenpaw.utils.command_runner import ( CommandExecutionError, Man...
1,001
27,200
QwenPaw
tests/unit/utils/test_system_info.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import pytest import qwenpaw.utils.system_info as system_info_module from qwenpaw.utils.system_info import get_system_info, get_vram_size_gb _NVIDIA_SMI_HEADER = ( "NVIDIA-SMI 560.94 Driver Version: 560.94 CUDA Ve...
127
3,327
QwenPaw
tests/unit/utils/test_telemetry.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import json from pathlib import Path from types import SimpleNamespace from unittest.mock import MagicMock import pytest import qwenpaw.utils.telemetry as telemetry_module from qwenpaw.utils.telemetry import ( TELEMETRY...
324
9,047
QwenPaw
tests/unit/utils/test_http.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import pytest from qwenpaw.utils.http import ( is_loopback_host, is_loopback_url, probe_host_for_bind_host, trust_env_for_url, ) @pytest.mark.parametrize( "host", [ "localhost", "localhost.", "127.0.0.1", ...
94
2,341
QwenPaw
tests/unit/utils/test_io_utils.py
.py
# -*- coding: utf-8 -*- """Tests for asynchronous and atomic filesystem utilities.""" from __future__ import annotations import asyncio import json import os import stat import threading from pathlib import Path from unittest.mock import patch import pytest import yaml from qwenpaw.utils.io_utils import ( appen...
336
9,942
QwenPaw
tests/unit/utils/test_stdio.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations from unittest.mock import MagicMock import pytest import qwenpaw.utils.stdio as stdio_module from qwenpaw.utils.stdio import ( _close_fallback_streams, _is_stream_usable, ensure_standard_streams, ) @pytest.fix...
166
4,500
QwenPaw
tests/unit/utils/test_startup_display.py
.py
# -*- coding: utf-8 -*- """Tests for startup terminal displays.""" # pylint: disable=protected-access from io import StringIO import logging from unittest.mock import patch from rich.console import Console from rich.file_proxy import FileProxy from qwenpaw.utils.startup_display import AgentStartupDisplay def test_s...
118
3,738
QwenPaw
tests/unit/utils/test_port.py
.py
# -*- coding: utf-8 -*- """Tests for desktop backend port allocation.""" from unittest.mock import patch from qwenpaw.utils.port import try_bind_port def test_try_bind_port_handles_socket_construction_error() -> None: with patch( "qwenpaw.utils.port.socket.socket", side_effect=OSError("file desc...
15
407
QwenPaw
tests/unit/utils/test_platform.py
.py
# -*- coding: utf-8 -*- """Tests for qwenpaw.utils.platform helpers.""" from __future__ import annotations import logging import sys from unittest.mock import MagicMock, patch import pytest from qwenpaw.utils.platform import ( is_windows_admin, warn_unelevated_sandbox, ) @pytest.fixture() def _platform_ca...
184
5,996
QwenPaw
tests/unit/github/test_pr_ai_review_workflow.py
.py
# -*- coding: utf-8 -*- from pathlib import Path import yaml REPO_ROOT = Path(__file__).resolve().parents[3] WORKFLOW_PATH = REPO_ROOT / ".github" / "workflows" / "pr-ai-review.yml" def _load_workflow() -> dict: return yaml.safe_load(WORKFLOW_PATH.read_text(encoding="utf-8")) def test_ai_reviewer_and_publishe...
61
2,003
QwenPaw
tests/unit/github/test_real_behavior_proof_policy.py
.py
# -*- coding: utf-8 -*- """Unit tests for the real-behavior-proof policy. Ported from openclaw's ``real-behavior-proof-policy.test.ts`` and adapted to QwenPaw's Python implementation. """ # pylint: disable=protected-access,redefined-outer-name,unused-argument # pylint: disable=wrong-import-position,line-too-long # fla...
275
8,675
QwenPaw
tests/unit/github/test_real_behavior_proof_check.py
.py
# -*- coding: utf-8 -*- """Unit tests for real_behavior_proof_check.py CI entry point. Covers event payload parsing, missing fields, and label API failure paths that the pure-policy tests do not exercise. """ # pylint: disable=protected-access,redefined-outer-name,unused-argument # pylint: disable=wrong-import-positio...
188
6,320
QwenPaw
tests/unit/cli/test_desktop_cmd.py
.py
# -*- coding: utf-8 -*- """Unit tests for the legacy pywebview desktop bridge.""" import io import types import urllib.request from qwenpaw.cli import desktop_cmd class _Response(io.BytesIO): def __enter__(self) -> "_Response": return self def __exit__(self, *_args: object) -> None: self.cl...
63
1,727
QwenPaw
tests/unit/cli/test_cli_doctor_proxy.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations from typing import Any from qwenpaw.cli import doctor_cmd class _Response: def __init__( self, status_code: int = 200, json_data: dict[str, Any] | None = None, text: str = "", co...
54
1,465
QwenPaw
tests/unit/cli/test_cron_cmd.py
.py
# -*- coding: utf-8 -*- import copy import click import pytest from click.testing import CliRunner from qwenpaw.cli.cron_cmd import ( _build_spec_from_cli, _resolve_update_spec, cron_group, ) def _agent_spec(**overrides): values = { "task_type": "agent", "schedule_type": "cron", ...
281
8,205
QwenPaw
tests/unit/cli/test_channels_cmd.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,redefined-outer-name """Tests for interactive plugin channel configuration.""" import json from pathlib import Path import sys from unittest.mock import patch import pytest from qwenpaw.cli import channels_cmd from qwenpaw.plugins.registry import PluginRegis...
166
4,907
QwenPaw
tests/unit/cli/test_doctor_health.py
.py
# -*- coding: utf-8 -*- """Tests for the API health probe used by ``qwenpaw doctor``.""" # pylint: disable=protected-access from __future__ import annotations from typing import Any import httpx from qwenpaw.cli import doctor_cmd class _Response: def __init__( self, status_code: int, js...
103
2,718
QwenPaw
tests/unit/cli/test_cli_shutdown.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from click.testing import CliRunner from qwenpaw.cli.main import cli from qwenpaw.cli import shutdown_cmd as shutdown_cmd_module from qwenpaw.cli.shutdown_cmd import ( _find_windows_wrapper_ancestor_pids, _terminate_pid, ) def test_shutdown_command_...
239
7,087
QwenPaw
tests/unit/cli/test_doctor_connectivity.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import pytest from qwenpaw.cli import doctor_connectivity from qwenpaw.config.config import OneBotConfig, TelegramConfig def test_probe_telegram_uses_custom_base_url(monkeypatch) -> None: captured: dict[str, object] = {} def _fake_get_ok(url: str, ...
110
2,815
QwenPaw
tests/unit/cli/test_acp_cmd.py
.py
# -*- coding: utf-8 -*- """Tests for the ``qwenpaw acp`` CLI command.""" from __future__ import annotations from click.testing import CliRunner from qwenpaw.cli.acp_cmd import acp_cmd def test_acp_cmd_passes_local_diagnostics(monkeypatch, tmp_path): captured = {} async def fake_run_qwenpaw_agent(**kwargs):...
36
860
QwenPaw
tests/unit/cli/test_cli_version.py
.py
# -*- coding: utf-8 -*- from importlib.metadata import version as package_version from packaging.version import Version from click.testing import CliRunner from qwenpaw.__version__ import __version__ from qwenpaw.cli.main import cli def test_cli_version_option_outputs_current_version() -> None: result = CliRun...
23
611
QwenPaw
tests/unit/cli/test_cli_task.py
.py
# -*- coding: utf-8 -*- """Tests for the ``qwenpaw task`` headless CLI command.""" from __future__ import annotations import json import os from pathlib import Path from unittest.mock import AsyncMock, MagicMock import pytest from click.testing import CliRunner from qwenpaw.cli.main import cli from qwenpaw.cli.task_...
466
14,886
QwenPaw
tests/unit/cli/test_cli_agents.py
.py
# -*- coding: utf-8 -*- """Tests for the ``qwenpaw agents`` CLI surface.""" from __future__ import annotations import json from types import SimpleNamespace from unittest.mock import Mock from click.testing import CliRunner from qwenpaw.cli.main import cli from qwenpaw.constant import BUILTIN_QA_AGENT_SKILL_NAMES f...
707
19,241
QwenPaw
tests/unit/cli/test_cli_update.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import sys import json from pathlib import Path import httpx import pytest from click.testing import CliRunner from qwenpaw.__version__ import __version__ from qwenpaw.cli.main import cli from qwenpaw.cli.update_cmd import ( InstallInfo, RunningServi...
952
26,674
QwenPaw
tests/unit/cli/test_cli_http_proxy.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from qwenpaw.agents.tools import agent_management from qwenpaw.cli import http as cli_http # CLI API clients hit the local QwenPaw service, so loopback URLs skip proxies. def test_cli_http_client_bypasses_env_for_loopback(monkeypatch) -> None: captured: ...
51
1,477
QwenPaw
tests/unit/cli/tui/test_compat.py
.py
# -*- coding: utf-8 -*- """Regression tests for Textual compatibility fixes.""" from __future__ import annotations # Tests exercise the private wrapper and its one-time installation state. # pylint: disable=protected-access from textual.geometry import Offset from textual.screen import Screen from textual.widget imp...
62
1,769
QwenPaw
tests/unit/cli/tui/test_app.py
.py
# -*- coding: utf-8 -*- """Pilot-driven smoke tests for the Textual app with a fake transport.""" from __future__ import annotations # Tests poke at the app's internals and use terse fixtures. # pylint: disable=protected-access,not-an-iterable,disallowed-name # pylint: disable=consider-using-with,unnecessary-lambda #...
1,740
60,100
QwenPaw
tests/unit/cli/tui/test_status_bar.py
.py
# -*- coding: utf-8 -*- """Status bar: compact token formatting and the in-flight estimate marker.""" from __future__ import annotations # ``bar`` is a fine local name for a StatusBar widget under test. # pylint: disable=disallowed-name import pytest from rich.text import Text from qwenpaw.cli.tui.widgets.status_ba...
193
6,392
QwenPaw
tests/unit/cli/tui/_fake_acp_agent.py
.py
# -*- coding: utf-8 -*- """A minimal ACP agent used to exercise the TUI's AcpTransport in tests. Run as ``python _fake_acp_agent.py`` (stdio). It speaks just enough ACP to: * answer ``initialize`` / ``new_session`` * stream a thought, two text deltas and a completed tool call on ``prompt`` * request permission when th...
225
6,513
QwenPaw
tests/unit/cli/tui/test_launch.py
.py
# -*- coding: utf-8 -*- """Tests for launching the bundled TUI (`qwenpaw` / `qwenpaw tui`). Replaces paw's old ``test_cli.py`` + ``test_resolve.py``: the standalone ``paw`` command and PATH-based resolution were dropped when the TUI moved into QwenPaw. The TUI now spawns ``qwenpaw acp`` using the *current* interpreter...
372
10,429
QwenPaw
tests/unit/cli/tui/test_normalize.py
.py
# -*- coding: utf-8 -*- """Unit tests for the ACP-update → TuiEvent normalizer.""" from __future__ import annotations # ``assert normalize_update(...) == []`` reads clearer than ``not ...`` here. # pylint: disable=use-implicit-booleaness-not-comparison from types import SimpleNamespace import pytest from acp impor...
376
10,567
QwenPaw
tests/unit/cli/tui/test_welcome_message.py
.py
# -*- coding: utf-8 -*- """Welcome logo rendering.""" from __future__ import annotations # Tests exercise the widget's private rendering helpers directly. # pylint: disable=protected-access import pytest from qwenpaw.cli.tui.widgets.messages import ( WelcomeMessage, _bounce, _bright_dot_hex, _relati...
148
4,844
QwenPaw
tests/unit/cli/tui/test_acp_transport.py
.py
# -*- coding: utf-8 -*- """End-to-end test of AcpTransport against a fake ACP agent subprocess.""" from __future__ import annotations # Tests assert on transport internals for focused coverage. # pylint: disable=protected-access import asyncio import os import sys import time from types import SimpleNamespace impor...
386
12,119
QwenPaw
tests/unit/cli/tui/conftest.py
.py
# -*- coding: utf-8 -*- """Test fixtures: keep paw's state (logs) out of the real state dir.""" from __future__ import annotations import os import tempfile # Point the TUI's state dir at a unique temp location for the whole test # session before any TUI module reads it. A unique per-session dir (vs a fixed # path) ...
14
503
QwenPaw
tests/unit/checkpoints/test_checkpoint_basic.py
.py
# -*- coding: utf-8 -*- """Command-level tests for checkpoint basics.""" # pylint: disable=redefined-outer-name from __future__ import annotations import asyncio import json import os import shutil import threading from pathlib import Path from types import SimpleNamespace import pytest from qwenpaw.app.task_track...
823
24,352
QwenPaw
tests/unit/checkpoints/test_checkpoint_hooks.py
.py
# -*- coding: utf-8 -*- """Checkpoint hook scheduling behavior.""" from __future__ import annotations from types import SimpleNamespace import pytest from qwenpaw.agents.acp.meta import ACP_EPHEMERAL_META_KEY from qwenpaw.checkpoints.hooks import CheckpointAutoSnapshotHook from qwenpaw.checkpoints.runtime import RU...
109
2,830
QwenPaw
tests/unit/checkpoints/test_checkpoint_restore.py
.py
# -*- coding: utf-8 -*- """Restore coverage for conversation, memory, and workspace files.""" # pylint: disable=protected-access from __future__ import annotations import asyncio import json import os import shutil import subprocess import threading from pathlib import Path from unittest.mock import patch import py...
1,249
38,826
QwenPaw
tests/unit/checkpoints/test_git_batch.py
.py
# -*- coding: utf-8 -*- """Protocol and lifecycle tests for the scoped Git blob batch reader.""" from __future__ import annotations import os import sys from pathlib import Path import pytest from qwenpaw.checkpoints.git_batch import GitBlobBatch from qwenpaw.checkpoints.models import CheckpointError def _batch( ...
97
3,262
QwenPaw
tests/unit/harnesses/test_capability_resolver.py
.py
# -*- coding: utf-8 -*- """Tests for shared third-party Harness capability resolution.""" from __future__ import annotations import json from pathlib import Path from types import SimpleNamespace import pytest from qwenpaw.app.driver_config_service import DriverConfigService from qwenpaw.drivers.constants import ( ...
222
6,833
QwenPaw
tests/unit/harnesses/test_qoder_event_mapper.py
.py
# -*- coding: utf-8 -*- """Tests for translating Qoder SDK messages.""" from __future__ import annotations import pytest # pylint: disable=wrong-import-position # flake8: noqa: E402,E501 pytest.importorskip( "qoder_agent_sdk", reason="optional qoder_agent_sdk (qoder extra) is required", ) from qoder_agent_s...
173
4,665
QwenPaw
tests/unit/harnesses/test_codex_adapter.py
.py
# -*- coding: utf-8 -*- """Tests for the Codex third-party agent adapter.""" # pylint: disable=protected-access from __future__ import annotations import asyncio import json from pathlib import Path from types import SimpleNamespace from typing import Any from unittest.mock import AsyncMock, MagicMock, patch import...
855
26,866
QwenPaw
tests/unit/harnesses/test_codex_projection.py
.py
# -*- coding: utf-8 -*- """Tests for QwenPaw capability projection into Codex.""" from __future__ import annotations from pathlib import Path import pytest from qwenpaw.harnesses.capabilities import ( HarnessMCPServerDefinition, HarnessRuntimeCapabilities, HarnessSkillDefinition, ) from qwenpaw.harnesse...
75
2,341
QwenPaw
tests/unit/harnesses/test_codex_app_server.py
.py
# -*- coding: utf-8 -*- """Tests for Codex app-server JSON-RPC request handling.""" # pylint: disable=protected-access from __future__ import annotations from unittest.mock import AsyncMock import pytest from qwenpaw.harnesses.codex.app_server import CodexAppServerClient @pytest.mark.asyncio async def test_serve...
33
897
QwenPaw
tests/unit/harnesses/test_codex_discovery.py
.py
# -*- coding: utf-8 -*- """Tests for discovering standalone Codex CLI installations.""" from __future__ import annotations from pathlib import Path from types import SimpleNamespace import pytest from qwenpaw.harnesses.codex import discovery from qwenpaw.harnesses.codex.discovery import ( default_install_candid...
228
5,898
QwenPaw
tests/unit/harnesses/test_runtime.py
.py
# -*- coding: utf-8 -*- """Tests for provider-neutral third-party agent routing.""" # pylint: disable=protected-access from __future__ import annotations from collections.abc import AsyncIterator from pathlib import Path from unittest.mock import patch import pytest from qwenpaw.harnesses.base import HarnessAdapte...
399
10,784
QwenPaw
tests/unit/harnesses/test_agent_backend_config.py
.py
# -*- coding: utf-8 -*- """Tests for agent-level runtime backend configuration.""" from qwenpaw.config.config import AgentProfileConfig from qwenpaw.harnesses.registry import get_provider def test_agent_backend_defaults_to_qwenpaw() -> None: config = AgentProfileConfig(id="agent-1", name="Agent") assert con...
53
1,492
QwenPaw
tests/unit/harnesses/test_workspace_routing.py
.py
# -*- coding: utf-8 -*- """Tests for workspace routing into a selected third-party agent.""" # pylint: disable=protected-access from __future__ import annotations from collections.abc import AsyncIterator from pathlib import Path from types import SimpleNamespace from typing import Any import pytest from qwenpaw.a...
63
1,688
QwenPaw
tests/unit/harnesses/test_session.py
.py
# -*- coding: utf-8 -*- """Tests for materialized third-party Agent sessions.""" from pathlib import Path import pytest from agentscope.state import AgentState from qwenpaw.app.chats.session import SafeJSONSession from qwenpaw.app.chats.utils import agentscope_msg_to_message from qwenpaw.harnesses.session import Har...
172
4,752
QwenPaw
tests/unit/harnesses/test_optional_dependencies.py
.py
# -*- coding: utf-8 -*- """Tests for optional third-party agent dependencies.""" from __future__ import annotations import sys import tomllib from pathlib import Path import pytest from qwenpaw.harnesses.base import MissingDependencyAdapter from qwenpaw.harnesses.registry import create_adapter def test_codex_and_...
49
1,566
QwenPaw
tests/unit/harnesses/test_qoder_adapter.py
.py
# -*- coding: utf-8 -*- """Tests for the Qoder third-party agent adapter.""" # pylint: disable=protected-access from __future__ import annotations import asyncio import base64 from pathlib import Path from typing import Any from unittest.mock import AsyncMock, patch import pytest # pylint: disable=wrong-import-pos...
722
20,937
QwenPaw
tests/unit/harnesses/test_qoder_discovery.py
.py
# -*- coding: utf-8 -*- """Tests for cross-platform Qoder CLI discovery.""" from __future__ import annotations from pathlib import Path import pytest # pylint: disable=wrong-import-position # flake8: noqa: E402,E501 pytest.importorskip( "qoder_agent_sdk", reason=( "importing qwenpaw.harnesses.qoder ...
130
3,391
QwenPaw
tests/unit/_compat/test_message.py
.py
# -*- coding: utf-8 -*- """Regression tests for legacy session message compatibility shims.""" from __future__ import annotations from agentscope.message import DataBlock, URLSource from qwenpaw._compat.message import _ensure_url_scheme, msg_from_dict def test_ensure_url_scheme_unc_path(): assert _ensure_url_s...
46
1,388
QwenPaw
tests/unit/backup/test_safe_swap.py
.py
# -*- coding: utf-8 -*- """Tests for backup restore directory swapping.""" from __future__ import annotations import errno import io import zipfile from contextlib import nullcontext from pathlib import Path from unittest.mock import patch import pytest from qwenpaw.backup._utils._mount_swap import ( OLD_CONTENT...
370
11,321
QwenPaw
tests/unit/backup/test_restore_targets.py
.py
# -*- coding: utf-8 -*- """Tests for restore target preflight checks.""" # pylint: disable=protected-access from __future__ import annotations from pathlib import Path import pytest from qwenpaw.backup._ops import restore from qwenpaw.backup.models import BackupValidationError def test_busy_restore_target_reports_...
45
1,195
QwenPaw
tests/unit/backup/test_restore_orchestration.py
.py
# -*- coding: utf-8 -*- """Tests for backup restore HTTP orchestration.""" from __future__ import annotations import asyncio import pytest from qwenpaw.backup import orchestration from qwenpaw.backup.models import ( BackupDetail, BackupValidationError, RestoreBackupRequest, ) def _detail() -> BackupDet...
157
4,566
QwenPaw
tests/unit/backup/test_restore_signature_trust.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import json import zipfile from pathlib import Path import pytest from qwenpaw.backup._utils.signing import ( resolve_signature_action, sign_trusted_backup, ) from qwenpaw.backup._utils.constants import META_FILE, PREFIX_CONFIG from qwenpaw.backup._u...
117
3,749
QwenPaw
tests/unit/backup/test_storage_signing.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import json import zipfile import pytest from qwenpaw.backup._ops import storage from qwenpaw.backup._utils import constants from qwenpaw.backup._utils.constants import META_FILE, PREFIX_CONFIG from qwenpaw.backup._utils.signing import key as signing_key fro...
194
6,104
QwenPaw
tests/unit/backup/test_restore_trust_helpers.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from qwenpaw.backup._ops.restore_helpers import ( LOCAL_PROTECTED_CONFIG_KEYS, overlay_local_keys, resolve_preserve_flag, ) from qwenpaw.backup.models import BackupMeta, RestoreBackupRequest def test_preserve_keys_are_limited_to_backup_trust_boun...
50
1,565
QwenPaw
tests/unit/backup/test_signing.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import json import zipfile from qwenpaw.backup._utils.constants import META_FILE, PREFIX_CONFIG from qwenpaw.backup._utils.signing import key as signing_key from qwenpaw.backup._utils.signing.digest import ( _assert_signed_fields_cover_model, verify_s...
56
1,761
QwenPaw
tests/unit/plugins/test_download_catalog.py
.py
# -*- coding: utf-8 -*- """Unit tests for src/qwenpaw/plugins/download_catalog.py.""" from __future__ import annotations from qwenpaw.plugins.download_catalog import _is_entry_compatible def test_entry_with_qwenpaw_version_compatible() -> None: entry = { "id": "demo", "version": "1.0.0", ...
131
3,740
QwenPaw
tests/unit/plugins/test_plugin_api_extensions.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,protected-access,import-outside-toplevel """Unit tests for plugin API extensions: #8, #10, #16. Tests cover: - #8: register_uninstall_hook and its execution during unload_plugin - #10: Plugin validator uses submodule_search_locations for relative imports -...
781
25,874
QwenPaw
tests/unit/plugins/test_omp_loop_ui_i18n.py
.py
# -*- coding: utf-8 -*- """OMP loop UI i18n catalog and CommandSpec metadata wiring.""" from __future__ import annotations import importlib.util import sys from functools import lru_cache from pathlib import Path import pytest _REPO = Path(__file__).resolve().parents[3] _I18N_PATH = ( _REPO / "plugins" ...
77
2,001
QwenPaw
tests/unit/plugins/__init__.py
.py
# -*- coding: utf-8 -*- """Unit tests for the plugins subpackage."""
3
69
QwenPaw
tests/unit/plugins/test_generate_plugin_metadata.py
.py
# -*- coding: utf-8 -*- # pylint: disable=wrong-import-position """Unit tests for scripts/pack/generate_plugin_metadata.py.""" from __future__ import annotations import json import sys import zipfile from pathlib import Path import pytest # Add scripts/pack to the path so we can import the module sys.path.insert( ...
294
9,184
QwenPaw
tests/unit/plugins/test_cloudpaw_mission_prompt_patch.py
.py
# -*- coding: utf-8 -*- """Tests for the CloudPaw mission prompt patch.""" import importlib.util import sys import types from pathlib import Path def _load_mission_prompts(monkeypatch): """Load mission prompts without importing the full qwenpaw package.""" for package_name in ( "qwenpaw", "qw...
79
2,354
QwenPaw
tests/unit/plugins/test_plugin_lifecycle_lock.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Per-plugin lifecycle lock serializes load/unload/reinstall.""" from __future__ import annotations import asyncio from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch import pytest from qwenpaw.app.routers.plugins import ( _f...
362
11,725
QwenPaw
tests/unit/plugins/test_plugin_load_isolation.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,protected-access """Tests for plugin load-failure isolation. Verifies that when ``_load_backend_module`` fails at any stage (exec_module, missing ``plugin`` attribute, ``register()`` exception), the framework cleans up: - ``sys.modules`` (main module, sub...
450
14,334
QwenPaw
tests/unit/plugins/computer_use/test_global_off.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Turning the feature off has to reach every session, not just one. Off is the global kill switch. A session left waiting on an approval would be granted access later and act on a desktop the user had already switched the feature off for -- so the switch has ...
182
5,048
QwenPaw
tests/unit/plugins/computer_use/test_shared_state_guards.py
.py
# -*- coding: utf-8 -*- """Tests for the guards that keep shared tool state from being corrupted.""" # Both guards are module-private on purpose; exercising them directly is the # point of these tests. # pylint: disable=protected-access import threading from computer_use import access as access_module from computer_u...
101
3,352
QwenPaw
tests/unit/plugins/computer_use/test_computer_use_router.py
.py
# -*- coding: utf-8 -*- """Tests for the Computer Use plugin status route.""" # Fixtures are requested for their side effects, so some are never read. # pylint: disable=unused-argument, use-implicit-booleaness-not-comparison from __future__ import annotations from types import SimpleNamespace import pytest from fas...
344
9,911
QwenPaw
tests/unit/plugins/computer_use/test_manifest_compatibility.py
.py
# -*- coding: utf-8 -*- """Tests for the plugin manifest's declared QwenPaw compatibility range.""" import json from pathlib import Path from packaging.version import Version from qwenpaw._version_compat import check_plugin_version_compat from qwenpaw.plugins.architecture import PluginManifest _MANIFEST = ( Pat...
68
2,292
QwenPaw
tests/unit/plugins/computer_use/test_turn_lifecycle.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Retiring a turn, and the cache bound that depends on it. The host mints a turn id per request and nothing retired it, so a session that used the tool once kept its turn, its connection and the helper's per-turn state indefinitely. That also made the cache b...
170
5,936
QwenPaw
tests/unit/plugins/computer_use/test_capability_recovery.py
.py
# -*- coding: utf-8 -*- """Recovering after the native helper goes away. The capability names a pipe or socket the helper is listening on. It used to be cached for the life of the process with no way to retire it, so a helper that crashed left the client reconnecting to a name that answered nothing -- for every reques...
145
5,089
QwenPaw
tests/unit/plugins/computer_use/test_plugin_config_seeding.py
.py
# -*- coding: utf-8 -*- """Tests for how the plugin seeds its tool into agent configurations.""" # The seeding helper is module-private on purpose; exercising it directly is # the point of these tests. # pylint: disable=protected-access from types import SimpleNamespace import plugin def _agent_config(tools=None): ...
42
1,320
QwenPaw
tests/unit/plugins/computer_use/test_windows_pipe.py
.py
# -*- coding: utf-8 -*- """Regression tests for the overlapped Windows pipe transport. Every test here deadlocks or hangs forever with the pre-fix synchronous pipe handle, so they guard the overlapped I/O rework directly. """ # Nested helpers shadow the fixture name on purpose, and the fake handlers # accept the argu...
369
12,377
QwenPaw
tests/unit/plugins/computer_use/test_stop_semantics.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Per-turn Computer Use stopping without terminating the shared helper.""" from __future__ import annotations import asyncio import threading from collections.abc import Mapping from typing import Any import pytest from computer_use.client import ComputerU...
260
8,885
QwenPaw
tests/unit/plugins/computer_use/test_feature_state.py
.py
# -*- coding: utf-8 -*- """How the feature switch reads a state file it cannot trust. The switch decides whether desktop automation is allowed at all. Its default applies to an installation that has never chosen -- not to one whose recorded choice has become unreadable, where reading it as on would restore access the ...
130
4,175
QwenPaw
tests/unit/plugins/computer_use/test_protocol_contract.py
.py
# -*- coding: utf-8 -*- """The method vocabulary has to mean the same thing on both sides of the wire. The adapter and the native helper are written in different languages and share no build step, so their agreement rests on two lists of strings staying in step. Nothing catches a drift: a method only one side knows fa...
149
5,354
QwenPaw
tests/unit/plugins/computer_use/test_computer_use_protocol.py
.py
# -*- coding: utf-8 -*- """Tests for the thin Computer Use protocol adapter.""" # Tests reach into module internals to pin the protocol contract, and their # fakes deliberately accept arguments they ignore to match real signatures. # pylint: disable=protected-access, unused-argument, unnecessary-lambda # pylint: disab...
723
22,456
QwenPaw
tests/unit/plugins/computer_use/test_plugin_access.py
.py
# -*- coding: utf-8 -*- """Tests for plugin-local Computer Use application access decisions.""" from computer_use import access def _request( *, session_id: str = "session-1", app_id: str = "win32:contoso.editor", ): return access.AppApprovalRequest( request_id="native-request-1", ses...
79
2,488