我有扩展unittest.TestCase
的测试类,并使用nose_parameterized
进行参数化。我使用nosetests -v
来运行测试。我有鼻子测试版本1.3.7。在
我想让测试运行人员打印每个测试的名称。相反,它只打印传入测试的参数。在
<我的实际输出示例:
[with sentence='Put it on the top shelf of the bookshelf'] ... ok
[with **None={'world': [<WorldObject table>, ...'basic', 'language': 'Pick cup'}] ... ERROR
[with **None={'name': 'first action', 'langua...'' ... ERROR
[with **None={'name': 'two pointing choices',...'' ... ERROR
基于nose_parameterized
的documentation示例,我认为输出应该包含测试方法及其类的名称,大致如下所示。在
但事实并非如此
documentation进一步说明:
If the first parameter is a string, that string will be added to the end of the method name.
因此,根据我作为每个测试的第一个参数传入的字符串,输出应该如下所示:
language_analyzer_test_Pick_cup (md.LangaugeAnalyzerTest) ... ok
language_test_basic (md.ReferenceResolverTest) ... ERROR
reference_resolver_test_first_action (md.ReferenceResolverTest) ... ERROR
reference_resolver_test_two_pointing_choices (md.ReferenceResolverTest) ... ERROR
但是,唉。在
根据实际的输出,很难分辨出哪个测试方法正在运行,甚至很难判断它来自哪个测试类。在
如何让nose打印每个测试用例的测试名称?
{{{doc2>将在cd1}下添加一个参数。在
如果从测试中删除docstring,则应该获得文档中所示的方法名。在
相关问题 更多 >
编程相关推荐