{
  "id": "python/pytest-import-mode-importlib",
  "signature": "ImportError: cannot import name 'app' from 'test_app' (unknown location)",
  "signature_zh": "导入错误：无法从 'test_app' 导入名称 'app'（未知位置）",
  "regex": "ImportError:\\ cannot\\ import\\ name\\ 'app'\\ from\\ 'test_app'\\ \\(unknown\\ location\\)",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "When using importlib import mode, test modules are imported as top-level modules, causing name conflicts or missing imports.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用 importlib 导入模式时，测试模块作为顶级模块导入，导致名称冲突或缺失导入。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This may not be desirable if you need importlib for other reasons.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This can cause other import issues.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from mypackage import app",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "[pytest]\nimport-mode = importlib",
      "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": "partial",
  "first_seen": "2026-01-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}