# PytestDeprecationWarning: 不带 reason 的 pytest.mark.skip 已弃用
  @pytest.mark.skip
在 pytest 7.0 中弃用，未来版本将报错

- **ID:** `python/pytest-skip-marker-missing-reason`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

现代 pytest 中 `@pytest.mark.skip` 和 `@pytest.mark.skipif` 需要 `reason=` 关键字；省略会触发弃用警告，在 `-W error` 下变成错误。

## 版本兼容性

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

## 解决方案

1. **** (97% 成功率)
   ```
   Always pass a reason:
@pytest.mark.skip(reason='requires GPU')
def test_cuda(): ...

@pytest.mark.skipif(sys.platform == 'win32', reason='POSIX only')
def test_fork(): ...
   ```
2. **** (90% 成功率)
   ```
   Or use `pytest.importorskip` for optional deps:
np = pytest.importorskip('numpy', reason='numpy not installed')
   ```

## 无效尝试

- **** — Suppresses all deprecations, hiding real issues across the suite. (80% 失败率)
- **** — Changes semantics: xfail expects failure, skip does not run; tests may start passing and turn XPASS. (75% 失败率)
