Nose: How to skip tests by default?

烂漫一生 提交于 2020-01-03 10:48:10

问题


I am using Python's nose and I have marked some of my tests as "slow", as explained in the attrib plugin documentation.

I would like to skip all "slow" Tests by default when running nosetests, i.e. without having to write nosetests -a '!slow'. But I want to be able to run these tests when explicitly running them or writing nosetests -a 'slow'.

How can I achieve this?


回答1:


"Options are the same as on the command line, with the -- prefix removed" (https://nose.readthedocs.org/en/latest/usage.html#configuration)

A file setup.cfg with the following contents should work:

[nosetests]
attr=!speed=slow


来源:https://stackoverflow.com/questions/14674713/nose-how-to-skip-tests-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!