{
  "id": "python/pytest-asyncio-no-mark",
  "signature": "async def functions are not natively supported.\nYou need to install a suitable plugin for your async framework, for example:\n  - anyio\n  - pytest-asyncio",
  "signature_zh": "async def 函数不被原生支持。\n你需要为异步框架安装合适的插件，例如：\n  - anyio\n  - pytest-asyncio",
  "regex": "async\\ def\\ functions\\ are\\ not\\ natively\\ supported\\.\\\nYou\\ need\\ to\\ install\\ a\\ suitable\\ plugin\\ for\\ your\\ async\\ framework,\\ for\\ example:\\\n\\ \\ \\-\\ anyio\\\n\\ \\ \\-\\ pytest\\-asyncio",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "An async test function was collected without an asyncio marker or without pytest-asyncio in strict mode. In strict mode (default since 0.21), every async test must be decorated with @pytest.mark.asyncio.",
  "root_cause_type": "generic",
  "root_cause_zh": "异步测试函数被收集时缺少 asyncio 标记，或 pytest-asyncio 处于 strict 模式。自 0.21 起默认 strict 模式下，每个异步测试都必须用 @pytest.mark.asyncio 装饰。",
  "versions": [
    {
      "version": "0.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.24",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "pytest still sees an async def and refuses to run it; the wrapper never executes.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The ini option is ignored if the plugin isn't installed; error persists.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Add to pytest.ini:\n  [pytest]\n  asyncio_mode = auto\nOr decorate each test:\n  import pytest\n  @pytest.mark.asyncio\n  async def test_foo(): ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Install and use anyio instead:\n  pip install anyio\n  @pytest.mark.anyio\n  async def test_foo(): ...",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}