{
  "id": "python/pytest-cov-fail-under-mismatch",
  "signature": "FAIL Required test coverage of 90% not reached. Total coverage: 84.32%\nERROR: Coverage failure: total of 84.32 is less than fail-under=90.00",
  "signature_zh": "FAIL 未达到 90% 的测试覆盖率要求。总覆盖率：84.32%\nERROR: 覆盖率失败：总计 84.32 低于 fail-under=90.00",
  "regex": "FAIL\\ Required\\ test\\ coverage\\ of\\ 90%\\ not\\ reached\\.\\ Total\\ coverage:\\ 84\\.32%\\\nERROR:\\ Coverage\\ failure:\\ total\\ of\\ 84\\.32\\ is\\ less\\ than\\ fail\\-under=90\\.00",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "pytest-cov's --cov-fail-under threshold is higher than the actual measured coverage. Common when new code was added without tests, or when source paths in --cov are misconfigured so some modules show as 0%.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest-cov 的 --cov-fail-under 阈值高于实际测量的覆盖率。通常发生在添加了没有测试的新代码时，或者 --cov 中的源路径配置错误导致某些模块显示为 0%。",
  "versions": [
    {
      "version": "5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Treats the symptom; coverage continues to drift downward and the team loses the safety net.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Excludes code from measurement instead of testing it; reviewers reject the PR and real bugs ship untested.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "pytest --cov=src --cov-report=term-missing --cov-fail-under=0\n# then write tests for the missing lines, or:\npytest --cov=src --cov-report=html\nopen htmlcov/index.html",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "pytest --cov=src --cov-fail-under=90 \\\n  --cov-config=.coveragerc\n\n# .coveragerc\n[run]\nomit =\n    */migrations/*\n    */tests/*\n    */conftest.py",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-04",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}