# PytestUnknownMarkWarning: 未知的 pytest.mark.smoke - 是否为拼写错误？

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

## 根因

使用了自定义标记如 @pytest.mark.smoke 但未在 pytest 配置中注册，因此 pytest 警告其未知。启用严格标记时这会变成错误。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Register markers in pytest.ini:

[pytest]
markers =
    smoke: quick smoke tests
    slow: long-running tests
   ```
2. **** (93% 成功率)
   ```
   Or in pyproject.toml:

[tool.pytest.ini_options]
markers = [
  'smoke: quick smoke tests',
]
   ```

## 无效尝试

- **** — Suppressing the warning does not register the marker; `pytest -m smoke` still fails to select tests. (85% 失败率)
- **** — This changes test semantics and does not provide the intended selection behavior. (80% 失败率)
