{
  "id": "python/pytest-cov-no-data-collected-warning",
  "signature": "CoverageWarning: No data was collected. (no-data-collected)\n  warnings.warn(\"No data was collected.\", CoverageWarning)",
  "signature_zh": "CoverageWarning: 未收集到任何数据。(no-data-collected)\n  warnings.warn(\"未收集到任何数据。\", CoverageWarning)",
  "regex": "CoverageWarning:\\ No\\ data\\ was\\ collected\\.\\ \\(no\\-data\\-collected\\)\\\n\\ \\ warnings\\.warn\\(\"No\\ data\\ was\\ collected\\.\",\\ CoverageWarning\\)",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "coverage was started but never stopped, or the source path passed to `--cov` does not match any imported module. Common when tests import a different installed copy of the package than the one in CWD, or when `--cov=src` doesn't exist.",
  "root_cause_type": "generic",
  "root_cause_zh": "coverage 已启动但从未停止，或传给 `--cov` 的源路径不匹配任何已导入模块。常见于测试导入的是已安装副本而非 CWD 中的包，或 `--cov=src` 不存在。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The report has no data to display; it just prints an empty table.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Two coverage processes conflict; the .coverage file is corrupted or overwritten.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "pip install -e .\npytest --cov=myapp --cov-report=term-missing\n# or\npytest --cov=src/myapp",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "# pyproject.toml\n[tool.coverage.run]\nsource = [\"myapp\"]\n\n[tool.pytest.ini_options]\naddopts = \"--cov --cov-report=term-missing\"",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}