{
  "id": "python/pytest-cov-import-error",
  "signature": "CoverageFailure: Could not import module 'my_module' for coverage measurement",
  "signature_zh": "CoverageFailure: 无法导入模块 'my_module' 进行覆盖率测量",
  "regex": "CoverageFailure:\\ Could\\ not\\ import\\ module\\ 'my_module'\\ for\\ coverage\\ measurement",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "pytest-cov cannot import the specified module, likely because it is not installed or not in the Python path.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest-cov 无法导入指定的模块，可能是因为它未安装或不在 Python 路径中。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The module might already be installed in a different environment; the issue is often path-related rather than installation.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The module might be in a subpackage; coverage requires the full dotted path.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Run `python -c \"import my_module\"` to verify the module is importable, then adjust PYTHONPATH if needed.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Specify the full package path: `pytest --cov=src/my_module` or use `--cov=my_package.my_module`",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}