# async def 函数不被原生支持。
你需要为异步框架安装合适的插件，例如：
  - anyio
  - pytest-asyncio
  - pytest-tornasync
  - pytest-trio
  - pytest-twisted

- **ID:** `python/pytest-asyncio-no-plugin`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pytest 不原生支持运行 async 测试函数。未安装 pytest-asyncio（或其他异步插件）且未配置 asyncio_mode 时，异步测试会报此错。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   pip install pytest-asyncio, then add to pyproject.toml or pytest.ini:
[tool.pytest.ini_options]
asyncio_mode = "auto"

and mark tests with @pytest.mark.asyncio (or rely on auto mode).
   ```
2. **** (85% 成功率)
   ```
   Alternatively use anyio: `pip install anyio` and decorate with `@pytest.mark.anyio`.
   ```

## 无效尝试

- **** — Runs at import time, not collection time, and breaks fixtures/event loop reuse. (70% 失败率)
- **** — The marker is unknown without the plugin; test still fails with the same message. (75% 失败率)
