# 在 0.000 秒内运行了 0 个测试

OK

- **ID:** `python/unittest-tests-not-discovered`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

unittest 发现没有找到测试，因为模块/类/方法命名不匹配模式（test*.py、TestCase 子类、test_* 方法），或者起始目录错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   # tests/test_calc.py
import unittest

class TestCalc(unittest.TestCase):
    def test_add(self):
        self.assertEqual(1+1, 2)

# run
python -m unittest discover -s tests -p 'test*.py' -v
   ```
2. **** (90% 成功率)
   ```
   python -m unittest discover -s . -t . -p '*_test.py' -v
   ```

## 无效尝试

- **** — Verbosity shows the same 'Ran 0 tests'; it doesn't fix discovery. (95% 失败率)
- **** — Different discovery rules; may still collect zero if names are wrong. (60% 失败率)
- **** — Only affects direct execution, not discovery. (70% 失败率)
