{
  "id": "python/pytest-cov-context-not-configured",
  "signature": "CoverageWarning: No contexts were measured\n  warnings.warn(\"No contexts were measured\")",
  "signature_zh": "CoverageWarning: 未测量到任何上下文\n  warnings.warn(\"No contexts were measured\")",
  "regex": "CoverageWarning:\\ No\\ contexts\\ were\\ measured\\\n\\ \\ warnings\\.warn\\(\"No\\ contexts\\ were\\ measured\"\\)",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "`--cov-context=test` was passed but the coverage config does not enable dynamic contexts, or the coverage version does not support the requested context mode.",
  "root_cause_type": "generic",
  "root_cause_zh": "传入了 `--cov-context=test`，但 coverage 配置未启用动态上下文，或 coverage 版本不支持所请求的上下文模式。",
  "versions": [
    {
      "version": "5.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Only affects the failure threshold; contexts still not measured.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hides the warning but loses per-test coverage reporting that was the goal.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Enable dynamic contexts in coverage config:\n# pyproject.toml\n[tool.coverage.run]\ndynamic_context = \"test_function\"\n# then run:\npytest --cov=myapp --cov-context=test",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Or set the env var before running:\nCOVERAGE_DYNAMIC_CONTEXT=test_function pytest --cov=myapp --cov-context=test",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-27",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}