如果测试运行时间超过特定时间(比如 500 毫秒),我希望我的测试失败,因为当加载稍慢的测试负载时,它会很糟糕,突然间,每次运行测试套件时都会有这么大的延迟. Nose 是否已经有任何插件或任何东西可以做到这一点?
最佳答案
对于时间很重要的情况(例如实时要求):
http://nose.readthedocs.org/en/latest/testing_tools.html
nose.tools.timed(limit)
Test must finish within specified time limit to pass.
Example use:
from nose.tools import timed @timed(.1) def test_that_fails(): time.sleep(.2)
关于python - 让 Nose 无法通过慢速测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6548496/