# PytestUnknownMarkWarning: 未知的 pytest.mark.slow - 是否拼写错误？您可以注册自定义标记以避免此警告。

- **ID:** `python/pytest-mark-unknown`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

使用了如 @pytest.mark.slow 的自定义标记，但未在 pytest.ini、pyproject.toml 或 conftest.py 中注册，pytest 将其视为拼写错误。

## 版本兼容性

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

## 解决方案

1. **** (98% 成功率)
   ```
   # pytest.ini
[pytest]
markers =
    slow: marks tests as slow
    integration: needs external services
   ```
2. **** (98% 成功率)
   ```
   # pyproject.toml
[tool.pytest.ini_options]
markers = [
  'slow: marks tests as slow',
]
   ```

## 无效尝试

- **** — Silences the warning but --strict-markers will still fail the run, and the marker remains unregistered. (70% 失败率)
- **** — Changes test semantics; skip is not the same as a user-defined tag used for selection. (80% 失败率)
