使用和不使用unittest发现的不同unittest执行结果

时间:2017-01-11 15:18:42

标签: python unit-testing

我有一个包含许多测试文件的目录tests。当我逐个测试它们时,它们都会工作并返回这样的东西:

Ran 2 tests in 0.005s

OK (expected failures=1)

但是当我在测试文件夹中运行此命令:python -m unittest discover时,我得到:

Ran 27 tests in 13.950s

FAILED (failures=3, errors=1, expected failures=9)

为什么discover命令会发现错误?(我确信所有的测试都在运行,只是我正在测试的函数有点复杂和相关。 有没有其他干净的方法一次启动测试而不会出错?

0 个答案:

没有答案