是否有可用的插件:
@nose.plugins.expectedfailure
def not_done_yet():
a = Thingamajig().fancynewthing()
assert a == "example"
如果测试失败,将显示为跳过的测试:
^{pr2}$……但如果意外通过,则类似于失败,比如:
=================================
UNEXPECTED PASS: not_done_yet
---------------------------------
-- >> begin captured stdout << --
Things and etc
...
属于like SkipTest,但不是作为阻止测试运行的异常实现的。在
我唯一能找到的是this ticket关于支持unittest2
expectedFailure修饰符(尽管我宁愿不使用unittest2,即使nose支持它)
您可以使用以下两种方法之一:
^{} 装饰工
nose.tools.assert_raises
如果不引发异常,测试将失败。在
是的,我知道,三年前问过:)
如果我误解了,请原谅,但是您所希望的行为不是由corepython的
unittest
库和expectedFailure
修饰符一起提供的吗,它在扩展上与nose
兼容?在有关使用示例,请参见docs和a post about its implementation。在
我不知道nose插件,但是你可以很容易地编写你自己的decorator来完成。下面是一个简单的实现:
如果我运行这些测试:
^{pr2}$我从nose得到以下输出:
相关问题 更多 >
编程相关推荐