Files
qwenpaw/tests/integration/test_observability_backup_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

103 lines
2.8 KiB
Python

# -*- coding: utf-8 -*-
"""Integration tests for Observability + backup utils internals.
Covers src/qwenpaw/observability/langfuse.py (66 uncovered) and
src/qwenpaw/backup/_utils/safe_swap.py (97 uncovered).
"""
from __future__ import annotations
import pytest
# ------------------------------------------------------------------ #
# observability langfuse
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_langfuse_available_bool() -> None:
"""_langfuse_available returns a bool."""
from qwenpaw.observability.langfuse import _langfuse_available
assert isinstance(_langfuse_available(), bool)
@pytest.mark.integration
@pytest.mark.p1
def test_is_langfuse_enabled_bool() -> None:
"""is_langfuse_enabled returns a bool."""
from qwenpaw.observability.langfuse import is_langfuse_enabled
assert isinstance(is_langfuse_enabled(), bool)
@pytest.mark.integration
@pytest.mark.p1
def test_trace_context_roundtrip() -> None:
"""set_current_trace + get_current_trace round-trip."""
from qwenpaw.observability.langfuse import (
clear_current_trace,
get_current_trace,
set_current_trace,
)
set_current_trace(
trace_id="integ-trace-id",
parent_observation_id=None,
name="integ",
)
ctx = get_current_trace()
assert ctx is not None
clear_current_trace()
assert get_current_trace() is None
@pytest.mark.integration
@pytest.mark.p1
def test_current_generation_kwargs() -> None:
"""current_generation_kwargs returns a dict."""
from qwenpaw.observability.langfuse import (
current_generation_kwargs,
)
assert isinstance(current_generation_kwargs(), dict)
# ------------------------------------------------------------------ #
# backup safe_swap
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_restore_lock_timeout_seconds() -> None:
"""_restore_lock_timeout_seconds returns a positive float."""
from qwenpaw.backup._utils.safe_swap import (
_restore_lock_timeout_seconds,
)
assert _restore_lock_timeout_seconds() > 0
@pytest.mark.integration
@pytest.mark.p1
def test_cleanup_stale_restore_artifacts(tmp_path) -> None:
"""cleanup_stale_restore_artifacts runs on an empty dir."""
from qwenpaw.backup._utils.safe_swap import (
cleanup_stale_restore_artifacts,
)
cleanup_stale_restore_artifacts(tmp_path)
@pytest.mark.integration
@pytest.mark.p1
def test_lock_for_same_path(tmp_path) -> None:
"""_lock_for returns the same lock for the same destination."""
from qwenpaw.backup._utils.safe_swap import _lock_for
dst = tmp_path / "x"
assert _lock_for(dst) is _lock_for(dst)