优化代码

This commit is contained in:
2026-04-23 11:04:44 +08:00
parent d6ad90a7db
commit b9cd4dacec
10 changed files with 66 additions and 160 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "jiangchang-desktop-sdk"
version = "0.4.0"
version = "0.5.0"
description = "匠厂桌面应用自动化测试 SDK + 共享 pytest plugin"
requires-python = ">=3.10"
dependencies = ["playwright>=1.42.0"]
@@ -12,12 +12,15 @@ dependencies = ["playwright>=1.42.0"]
[project.optional-dependencies]
testing = ["pytest>=7.0"]
# 让 pytest 在 pip install 后自动发现并加载 jiangchang_desktop_sdk.testing.plugin
# 未 pip install 时(开发态 sys.path 注入skill 的 conftest 可改用
# pytest_plugins = ["jiangchang_desktop_sdk.testing.plugin"]
# 二者等价
[project.entry-points.pytest11]
jiangchang_desktop_sdk_testing = "jiangchang_desktop_sdk.testing.plugin"
# 注意:本 SDK **故意不注册 `[project.entry-points.pytest11]`**
#
# plugin 的加载**单一入口**是每个 skill 的 `tests/desktop/conftest.py`
# 通过显式 `pytest_plugins = ["jiangchang_desktop_sdk.testing.plugin"]` 声明
# 这样做的好处:
# - 保证不管 SDK 是 `pip install -e` 装的、还是仅通过 sys.path 注入的,
# plugin 的注册方式完全一致;
# - 避免 entry-point 与 `pytest_plugins` 同时生效导致 pluggy 抛
# `Plugin already registered under a different name`。
[tool.setuptools.packages.find]
where = ["src"]