# AttributeError: 模块 'sys' 没有属性 'version_info'

- **ID:** `python/unittest-skipif-attributeerror`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

skipIf 条件中的拼写错误：`version_info` 拼写错误或访问不正确，导致在测试发现期间出现 AttributeError。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Correct the attribute name: `@unittest.skipIf(sys.version_info < (3, 7), 'requires Python 3.7+')`
   ```
2. **** (90% 成功率)
   ```
   Use pytest markers instead: `@pytest.mark.skipif(sys.version_info < (3,7))`
   ```

## 无效尝试

- **** — This defeats the purpose of conditional skipping and may cause failures in unsupported environments. (80% 失败率)
- **** — Decorators cannot be wrapped in try-except in that way; it will still raise an error at import time. (90% 失败率)
