# 已跳过: (u)<function test_parse at 0x7f...> 的参数集为空

- **ID:** `python/pytest-parametrize-empty`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

`@pytest.mark.parametrize` 装饰器接收到空列表，pytest 因此跳过该测试。常见原因是 fixture 或生成器返回空集合。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   Ensure the parametrize list is non-empty:
CASES = load_cases()
assert CASES, 'no cases loaded'
@pytest.mark.parametrize('u', CASES)
def test_parse(u): ...
   ```
2. **** (85% 成功率)
   ```
   Use `pytest_generate_tests` to dynamically parametrize with a guard:
def pytest_generate_tests(metafunc):
    if 'u' in metafunc.fixturenames:
        cases = load_cases() or [pytest.param(None, marks=pytest.mark.skip('no cases'))]
        metafunc.parametrize('u', cases)
   ```

## 无效尝试

- **** — IDs don't create test cases; the parameter list is still empty. (75% 失败率)
- **** — Makes the test always skipped, losing coverage silently. (65% 失败率)
