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
84 lines
2.5 KiB
Python
84 lines
2.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
REPOSITORY_ROOT = Path(__file__).resolve().parents[3]
|
|
RUNTIME_FILE = (
|
|
REPOSITORY_ROOT
|
|
/ "plugins"
|
|
/ "apps"
|
|
/ "qwenpaw-data"
|
|
/ "backend"
|
|
/ "runtime.py"
|
|
)
|
|
APP_DIR = REPOSITORY_ROOT / "plugins" / "apps" / "qwenpaw-data"
|
|
|
|
|
|
def _load_runtime_module():
|
|
spec = importlib.util.spec_from_file_location(
|
|
"qwenpaw_data_app_runtime_under_test",
|
|
RUNTIME_FILE,
|
|
)
|
|
assert spec is not None and spec.loader is not None
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def test_context_python_preserves_virtualenv_launcher_symlink(
|
|
tmp_path: Path,
|
|
) -> None:
|
|
runtime = _load_runtime_module()
|
|
base_python = tmp_path / "base-python"
|
|
base_python.write_text("", encoding="utf-8")
|
|
launcher = tmp_path / ".venv-qwenpaw-data" / "bin" / "python"
|
|
launcher.parent.mkdir(parents=True)
|
|
launcher.symlink_to(base_python)
|
|
runtime.PLUGIN_DIR = tmp_path
|
|
|
|
selected = runtime.context_python()
|
|
|
|
assert selected == launcher.absolute()
|
|
assert selected != launcher.resolve()
|
|
|
|
|
|
def test_skill_layers_return_only_category_directories(tmp_path: Path) -> None:
|
|
runtime = _load_runtime_module()
|
|
analytics = tmp_path / "analytics"
|
|
(analytics / "metric-review").mkdir(parents=True)
|
|
(analytics / "metric-review" / "SKILL.md").write_text(
|
|
"# Metric review",
|
|
encoding="utf-8",
|
|
)
|
|
(tmp_path / "empty").mkdir()
|
|
|
|
assert runtime.skill_layers(tmp_path) == [analytics]
|
|
|
|
|
|
def test_backend_entry_loads_with_plugin_loader_package_shape() -> None:
|
|
module_name = "plugin_qwenpaw_data_contract_test"
|
|
spec = importlib.util.spec_from_file_location(
|
|
module_name,
|
|
APP_DIR / "backend" / "main.py",
|
|
submodule_search_locations=[str(APP_DIR)],
|
|
)
|
|
assert spec is not None and spec.loader is not None
|
|
module = importlib.util.module_from_spec(spec)
|
|
module.__package__ = module_name
|
|
module.__path__ = [str(APP_DIR)]
|
|
sys.modules[module_name] = module
|
|
try:
|
|
spec.loader.exec_module(module)
|
|
assert module.app.app_id == "qwenpaw-data"
|
|
assert module.plugin is module.app
|
|
finally:
|
|
for loaded_name in list(sys.modules):
|
|
if loaded_name == module_name or loaded_name.startswith(
|
|
f"{module_name}.",
|
|
):
|
|
sys.modules.pop(loaded_name, None)
|