Skip to main content

tuner-testkit

发行名 tuner-testkit,导入名 tuner_testkit。给被测系统(SUT)测试仓提供公共运行库与 CLI(db / API / Web UI / 录制 / mock),以及 Cursor/git DNA(rules、skills、hooks)。

业务资产(page/api objects、action words、features)留在各项目仓的 packages/ 与 tests/,不进本包。平台发新版本后,下游用 uv 按需升级,不必再整树拷贝运行库。


标准作业流程

1. 工具域:只装核心 kit(能 tuner-init 即可)

uv tool install 和业务仓 .venv 是两套环境。下游在 tool 域只装默认 wheel,用来拿 tuner-init / tuner-dna;不要在 tool 域打开 [db] / [api] 等 extra。

uv tool install tuner-testkit

入口命令是 tuner-init、tuner-dna 等(tuner-*),没有 tuner-testkit 这个 script。tuner-dump-ddl、tuner-recorder 等依赖 extra 的 CLI,请在业务仓用 uv run … 跑,走该仓 .venv。

2. 初始化测试仓

tuner-init scaffold ../my-sut-tests
cd ../my-sut-tests
uv sync

scaffold 会铺六层目录、写入依赖 tuner-testkit[db,api] 的 pyproject.toml,并执行一次 tuner-dna sync(把 .cursor/、docs/spec/、tools/git-hooks/ 放进项目树)。可在任意目录运行,不必先有测试仓。不要用 tuner-testkit init repo。

uv sync 把 db / api 装进业务仓 .venv,不是 tool 域。已有项目仓则在该仓根目录:

uv add "tuner-testkit[db,api]>=4.0.0"
uv sync

Web UI / 合录等按需再加 extra:

uv add "tuner-testkit[web-ui]"
uv add "tuner-testkit[recorder]"

测 kit 全能力(平台狗食仓等)一次打开全部能力 extra:

uv add "tuner-testkit[all]"
uv sync

3. 开始写业务

在项目仓里写,不要改 site-packages 里的 kit:

你写什么 放哪里
页面 / 接口资产 packages/page_objects/、packages/api_objects/
业务动作 packages/action_words/
BDD / pytest tests/features/、tests/pytest/
知识(DDL、用例) assets/
本仓私有工具 apps/(python -m apps.<name>)

代码里 from tuner_testkit.db import … / from tuner_testkit.page_test import …。密钥只放本机 config/env_local.py 或环境变量(TUNER_ENV、TUNER_DB_<ALIAS>_*),不要提交。

录制产物同样写到项目仓 packages/,不会写进 venv。

4. 获取 PyPI 上的更新

平台发新版本后,下游从 PyPI:tuner-testkit 取 wheel,不要再拷本仓源码。tool 域和业务仓 .venv 是两份安装,两边都要升,再铺 DNA。

先看当前装的是哪一版、PyPI 最新是哪一版:

uv tool list                          # tool 域里的 tuner-testkit
cd ../my-sut-tests
uv pip show tuner-testkit             # 业务仓 .venv

发行说明见 docs/changelog/FRAMEWORK.md 与该版本的 docs/changelog/TEMPLATE-*.md。

① tool 域(只升核心 CLI)

uv tool upgrade tuner-testkit

升的是 tuner-init / tuner-dna 所在环境。这里仍然不要加 [db] / [api]。尚未 uv tool install 过则先执行第 1 节。

② 业务仓 .venv(升运行库 + extras)

在项目仓根目录改依赖并同步 lock。保留你原来打开的 extra(普通仓 [db,api],狗食/全能力仓 [all]):

# 钉到某一发行版(推荐,和团队 lock 一致)
uv add "tuner-testkit[db,api]==4.3.0"

# 或只抬下限,让解析器选允许范围内的最新
# uv add "tuner-testkit[db,api]>=4.3.0"

uv sync

已经写过 >=4.0.0、只想把 lock 里的 kit 升到 PyPI 最新:

uv lock --upgrade-package tuner-testkit
uv sync

只改 pyproject.toml 里的版本再 uv lock / uv sync 也可以。一个 wheel 不能「只升 web-ui、钉死旧 db」。

③ 同步 DNA 并提交

uv add / uv sync 只更新 site-packages 里的运行库。Cursor 读的是项目树里的 .cursor/、docs/spec/、tools/git-hooks/,必须再铺一层:

tuner-dna sync
tuner-dna check
git add -A && git commit

tuner-dna check 核对项目树 DNA 是否与当前 PATH 上那份 kit 一致。建议先 uv tool upgrade,再 sync,避免 CLI 还是旧包、.venv 已是新包。

其他 AI IDE:DNA 以 Cursor 布局为源,tuner-dna sync --ide claude,agents(或 all)把 skills 渲染到 .claude/skills/ / .agents/skills/、subagents 到 .claude/agents/,并生成 CLAUDE.md(@AGENTS.md + always-on 规则内联 + 路径规则清单)。 tuner-dna targets 列出各目标落点;hooks.json 不跨工具翻译。目录约定随各工具文档变动,用前核对。

新仓第一次仍用第 2 节的 tuner-init scaffold(会写依赖并做一次 tuner-dna sync),不是每次发版都重新 scaffold。

[phone-ui] 为预留空 extra,4.0 未实现。


extras

extra 内容
(默认 wheel) config / logging、tuner-init、tuner-dna(tool 域只装这个)
[db] MySQL / SQL Server / PostgreSQL(装在业务仓 .venv)
[api] api_test(HTTP 客户端)
[web-ui] page_test + Playwright
[phone-ui] 预留,无实现
[recorder] 合录 / 仅 UI / mitmproxy 代理
[mock] 按冻结的 api_objects 回放
[excel] / [fake] 表格 / 假数据
[bdd] / [test] behave / pytest
[all] 元 extra:上述能力 extra 的并集(不含 [dev])
[dev] tuner-testkit[all],给本仓 editable 开发

CLI 与 python -m tuner_testkit.… 等价,例如 tuner-recorder、tuner-page-recorder、tuner-api-recorder、tuner-mock-server。依赖 extra 的命令在业务仓用 uv run tuner-dump-ddl / uv run tuner-recorder。


安全

不得把 token、cookie、Authorization、密码、session 写入仓库(含 capture 与 api_objects)。凭证只允许运行时注入。


本仓库(平台源码)

克隆后在仓库根目录开发 kit 本身:

uv venv
uv sync --extra all

uv sync --extra dev 与 --extra all 等价(dev 只是引用 [all])。

本仓是平台仓,不是 workspace。dogfood/ 是用 tuner-init scaffold dogfood --no-ai 生成的 workspace 示范 (被测系统 = 平台本身,uv workspace 成员,共用 .venv):路线图在 dogfood/assets/domain-notes/platform/roadmap.md, 验收活文档在 dogfood/tests/features/。见 dogfood/README.md。

6.0.0 发行说明(一条用例一个文件)见 docs/changelog/TEMPLATE-6.0.0.md;5.3.1 发行说明(已回答提问归档)见 docs/changelog/TEMPLATE-5.3.1.md;5.3.0 发行说明(功能用例集 assets/testcases/)见 docs/changelog/TEMPLATE-5.3.0.md;5.2.0 发行说明(work task / 测试设计 / 证据附件)见 docs/changelog/TEMPLATE-5.2.0.md;5.1.0 发行说明(工作台 / meta stamp / --json)见 docs/changelog/TEMPLATE-5.1.0.md;5.0.0(Plane Job 协议退场、tuner-workspace)见 TEMPLATE-5.0.0.md;4.3.0 见 TEMPLATE-4.3.0.md;3.x → 4.x 迁移见 TEMPLATE-4.0.0.md。平台能力地图见 INDEX.md。

Metadata

Release files for tuner-testkit 6.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tuner-testkit 6.0.0
File Size Uploaded Provenance Actions
tuner_testkit-6.0.0.tar.gz 379.1 kB Without provenance Details for tuner_testkit-6.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tuner-testkit 6.0.0
File Interpreter ABI Platform Actions
tuner_testkit-6.0.0-py3-none-any.whl Python 3 none any Details for tuner_testkit-6.0.0-py3-none-any.whl

Total release size: 875.2 kB

Release files / tuner_testkit-6.0.0.tar.gz

Download URL tuner_testkit-6.0.0.tar.gz
Size 379.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4dfc0f688c71bbda4535ca14164fc87bdc056af7c0b45041b8bb5fe7c97a6aba
BLAKE2b-256 checksum
How to use checksums
d64589e654110fa9cd4b8775a0ffbcc0f3947444d6c335b2027e6dd8e1147484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tuner_testkit-6.0.0-py3-none-any.whl

Download URL tuner_testkit-6.0.0-py3-none-any.whl
Size 496.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
661e4a3fc1f94c0ee3d1e3dcd492a3e3c432ecf086dbccedb35fcc3d1c9dfe8e
BLAKE2b-256 checksum
How to use checksums
7f9fc2d560ca8636200da94d9f7c34b6209d6d4d5dd4f3e78995eaeb908b8fec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for tuner-testkit 6.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page