# fixture 'request.param' 未找到
可用 fixtures: ...

- **ID:** `python/pytest-parametrize-indirect-missing-fixture`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在 @pytest.mark.parametrize 中使用 indirect=True 要求参数名匹配已存在的 fixture。如果 fixture 缺失或命名错误，pytest 会尝试将 'request.param' 解析为 fixture 并失败。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   @pytest.fixture
def user(request):
    return User(name=request.param)

@pytest.mark.parametrize('user', ['alice', 'bob'], indirect=True)
def test_user(user):
    ...
   ```
2. **** (90% 成功率)
   ```
   @pytest.mark.parametrize('x,y', [(1,2),(3,4)], indirect=['x'])
def test_xy(x, y):  # x goes through fixture, y is raw
    ...
   ```

## 无效尝试

- **** — Removes the fixture indirection entirely; the test may now receive raw params instead of fixture-processed values, breaking test logic. (70% 失败率)
- **** — Fixture names cannot contain dots; pytest rejects the definition. (98% 失败率)
