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

- **ID:** `python/pytest-asyncio-not-installed`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在没有异步插件的情况下，pytest 无法运行 `async def` 测试函数。测试会被收集，但 pytest 拒绝执行，因为没有管理事件循环。

## 版本兼容性

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

## 解决方案

1. **** (98% 成功率)
   ```
   Install the plugin and enable auto mode:

pip install pytest-asyncio

# pytest.ini
[pytest]
asyncio_mode = auto
   ```
2. **** (90% 成功率)
   ```
   Use anyio instead:

pip install anyio

# test file
import pytest

@pytest.mark.anyio
async def test_thing():
    ...
   ```

## 无效尝试

- **** — The test function itself is still async, so pytest still rejects it during collection. (90% 失败率)
- **** — The setting is only read by pytest-asyncio; without the plugin installed the option is ignored and the error persists. (95% 失败率)
