{
  "id": "python/pytest-asyncio-coroutine-not-awaited",
  "signature": "RuntimeWarning: coroutine 'test_async_func' was never awaited",
  "signature_zh": "RuntimeWarning: 协程 'test_async_func' 从未被等待",
  "regex": "RuntimeWarning:\\ coroutine\\ 'test_async_func'\\ was\\ never\\ awaited",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "An async test function was not awaited, often because the test was not marked with @pytest.mark.asyncio or the asyncio mode is not set to auto.",
  "root_cause_type": "generic",
  "root_cause_zh": "异步测试函数未被等待，通常是因为测试未标记 @pytest.mark.asyncio 或 asyncio 模式未设置为 auto。",
  "versions": [
    {
      "version": "0.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "pytest-asyncio handles the event loop; manually running can cause conflicts.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This changes the test to synchronous and may not test the intended behavior.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "import pytest\n\n@pytest.mark.asyncio\nasync def test_async_func():\n    result = await some_async_call()\n    assert result == expected",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "[pytest]\nasyncio_mode = auto\nThis automatically treats async tests as asyncio tests.",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}