W10可运行与验证级别: 核心权重: 2修复方式: 手动修改

    W10: Python 项目划分测试成本分层(pytest markers)

    为什么设立这条规则(一手实证依据)

    将测试按 unit、smoke、slow/network 划分 marker 后,AI 代理在本地默认跑秒级单测,不再因误触外网或慢测试卡死。

    修复建议在 pyproject.toml 注册至少 3 档 pytest markers,并在入口文件注明默认排除慢测试的命令。
    AgentLint 4,533 个开源仓库 CLAUDE.md 全量实证分析 (2026)
    多项目真实生产仓库审计记录 (2026)
    反例(会触发 W10 告警)
    # Anti-pattern triggering W10 (Test cost tiers defined (pytest markers))
    # All unit, slow, and live network tests run together with no pytest markers defined.
    推荐写法(通过 W10 检查)
    # Compliant harness passing W10 (Test cost tiers defined (pytest markers))
    # pyproject.toml defines fast/unit, slow, and network markers so agents run `-m 'not slow and not network'`.
    本地 CLI 或浏览器一键验证
    npm install -g agentlint-ai && agentlint check --check W10

    同属「可运行与验证」维度的更多规则