# Ran 0 tests in 0.000s

NO TESTS RAN

FAILED (errors=0)

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

## 根因

unittest 发现机制没有找到任何测试方法，因为类没有继承 unittest.TestCase、方法名不以 `test` 开头，或模块没有命名为 `test*.py` / 起始目录不正确。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Ensure the class inherits TestCase and methods start with test:
import unittest
class TestMath(unittest.TestCase):
    def test_add(self):
        self.assertEqual(1+1, 2)
   ```
2. **** (90% 成功率)
   ```
   Point discovery at the right start dir and pattern:
python -m unittest discover -s tests -p 'test_*.py' -v
   ```

## 无效尝试

- **** — Default discovery pattern is `test*.py`; `tests.py` does not match, so still 0 tests. (80% 失败率)
- **** — Running via `python -m unittest discover` ignores that block; discovery still finds nothing. (75% 失败率)
