# 运行了 0 个测试，耗时 0.000 秒

未运行任何测试

- **ID:** `python/unittest-test-discovery-failure`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

unittest 未发现任何测试，通常是因为测试文件未命名为 test_*.py 或测试类未继承自 unittest.TestCase。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Rename files to test_*.py and make test classes subclass unittest.TestCase. Use python -m unittest discover -s tests -p 'test_*.py'
   ```
2. **** (90% 成功率)
   ```
   python -m unittest tests.test_module
   ```

## 无效尝试

- **** — unittest discovery relies on the test_*.py pattern; renaming may break discovery further. (95% 失败率)
- **** — This may run tests if the file has a if __name__ == '__main__' block, but does not fix discovery for all tests. (80% 失败率)
