E.
======================================================================
ERROR: test_fail (__main__.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/Lernkurve/Desktop/PythonDemos/a.py", line 9, in test_fail
call_method_that_does_not_exist()
NameError: global name 'call_method_that_does_not_exist' is not defined
----------------------------------------------------------------------
Ran 2 tests in 0.000s
FAILED (errors=1)
[Finished in 0.047s]
您可以使用Atom Python Test插件。它支持:
它还支持向测试执行添加其他参数,并允许运行unitttest.TestCase。
安装
按如下方式安装Script包:
a)启动原子
b)按Ctrl+Shift+p,键入“安装软件包和主题”,然后按Enter打开软件包视图
c)搜索“script”并安装软件包
单元测试示例test.py
编写单元测试并将其保存为
test.py
。运行单元测试
控制台输出
因为单元测试
test_fail
将失败,所以这将是控制台输出:相关问题 更多 >
编程相关推荐