{
  "id": "python/pytest-cov-fail-under-missing",
  "signature": "FAIL Required test coverage of 80% not reached. Total coverage: 74.31%",
  "signature_zh": "FAIL 未达到要求的 80% 测试覆盖率。总覆盖率: 74.31%",
  "regex": "FAIL\\ Required\\ test\\ coverage\\ of\\ 80%\\ not\\ reached\\.\\ Total\\ coverage:\\ 74\\.31%",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "pytest-cov --cov-fail-under compares total coverage against the threshold. Coverage is computed on the whole package, including files not exercised by the current test subset.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest-cov 的 --cov-fail-under 将总覆盖率与阈值比较。覆盖率基于整个包计算，包括当前测试子集未执行到的文件。",
  "versions": [
    {
      "version": "5.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "6.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Excludes real code from coverage and hides untested paths rather than testing them.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disables the gate entirely and lets coverage regress silently.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Scope coverage to changed files in CI:\n\npytest --cov=app --cov-fail-under=80 --cov-report=term-missing",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use diff-cover to enforce coverage only on new lines:\n\ndiff-cover coverage.xml --compare-branch=origin/main --fail-under=80",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-06",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}