python 单元测试出现 Ran 0 tests in 0.000s
OK Empty suite
出现这个空匹配的原因有以下两种
1、测试的函数没有以test开头
2、在unittest.main()的前面没有
3、你测试的类没有继承unittest.TestCase
解决方案
1、把你的类继承unittest.TestCase
2、检查你的测试函数是否以test开头,如 def test_first_last_name(self):
3、查看main函数前是否正确如:
以上检查完毕直接测试,成功!