{
  "id": "python/pytest-failed-to-import-test-module",
  "signature": "ModuleNotFoundError: No module named 'tests.test_api'",
  "signature_zh": "模块未找到错误：没有名为'tests.test_api'的模块",
  "regex": "ModuleNotFoundError:\\ No\\ module\\ named\\ 'tests\\.test_api'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "pytest无法导入测试模块，通常因为模块路径不在PYTHONPATH中，或者包结构不正确。",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest导入测试模块失败，路径配置或包结构问题。",
  "versions": [
    {
      "version": "3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "临时修改路径，可能影响其他测试，且不优雅。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "文件名不是根本原因，除非命名不符合pytest规则。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.8,
      "how": "touch tests/__init__.py",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "[pytest]\npythonpath = .",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-03",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}