允许您根据测试的属性修改测试的docstring
nose-docstring-modifier的Python项目详细描述
该项目位于GitHub
安装
您可以使用pip安装nose docstring修饰符
$ pip install nose-docstring-modifier
使用
给定以下测试函数,它使用nose ittr插件:
@ittr(platforms=['P1','P2','P3'])@attr(section='MySection',type='functional+',module='MyModule',id=1)deftest_function(self):""" This is the original docstring """forplatforminself.platforms:ok_(True)
使用nosetest使用nose docstring修饰符运行它插件:
nosetests --with-docstring-modifier --prefix=id,section,platform --suffix=type --replace=('s','S')
将打印
(1, MySection, P1) ThiS iS the original docString (functional+) ... ok (1, MySection, P2) ThiS iS the original docString (functional+) ... ok (1, MySection, P3) ThiS iS the original docString (functional+) ... ok
请注意,如果在docstring上硬编码平台,则无法获得动态输出,即使测试在三个不同的平台上运行,也将获得相同的平台。
功能
- 使用多进程插件:
nosetests --processes=10 --process-restartworker with-docstring-modifier --prefix=id
在10个进程之间展开测试运行,将id属性附加到每个测试。
历史记录
0.0.6(2014-11-25)
- 增加了仅显示docstring第一行的功能
- 改变了–replace调用:–replace=('s','s')
0.0.5(2014-11-24)
- 修补程序-修复了运行插件时由于与另一个即将到来的插件的依赖关系而导致错误的错误
0.0.4(2014-11-06)
- 代码设计更改
0.0.3(2014-11-05)
- 多处理支持
0.0.2(2014-11-04)
- 初始版本