在我的测试代码中,我的 doctest 失败,但脚本以零返回值退出,这导致 CI 运行通过,这不是预期的。
这是 doctest 模块的正确行为吗?
我的脚本以:
if __name__ == '__main__':
import doctest
doctest.testmod()
输出如下:
**********************************************************************
File "test/test.py", line 7, in __main__
Failed example:
f(1,0)
Expected:
-----
type: <type 'exceptions.ZeroDivisionError'>
value: integer division or modulo by zero
x
-----
Got:
-----
type: <type 'exceptions.ZeroDivisionError'>
value: integer division or modulo by zero
-----
**********************************************************************
1 items had failures:
1 of 1 in __main__
***Test Failed*** 1 failures.
tux@iPad:~/programming/exception-notifier(fix-travis)(0)$ echo $?
0