# 0.01s 内未运行任何测试
ERROR: 找不到文件或目录: tests/test_missing.py

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

## 根因

传给 pytest 的路径不存在，或 -k 表达式未匹配任何测试（后者通常只显示 'no tests ran' 而无文件错误）。常见于 CI 配置拼写错误或测试文件被重命名。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   pytest --collect-only tests/ -q
# check the file exists:
ls tests/test_missing.py
# fix the path in CI config
   ```
2. **** (90% 成功率)
   ```
   pytest --collect-only -q -k 'login and not slow'
pytest -k 'login and not slow'
   ```

## 无效尝试

- **** — Hides the fact that the intended test file was renamed or moved; real tests are silently skipped. (85% 失败率)
- **** — Runs everything, which may be slow and may include tests that were intentionally excluded. (50% 失败率)
