鼻子:默认情况下如何跳过测试? [英] Nose: How to skip tests by default?

查看:73
本文介绍了鼻子:默认情况下如何跳过测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python的鼻子,并且已将某些测试标记为慢",如 attrib插件文档.

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

默认情况下,我想在运行nosetests时跳过所有慢速"测试,即不必编写nosetests -a '!slow'.但是我希望能够在显式运行它们或编写nosetests -a 'slow'时运行这些测试.

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'.

我该如何实现?

推荐答案

选项与命令行上的选项相同,删除了-前缀"(https://nose.readthedocs.org/en/latest/usage.html#configuration )

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

具有以下内容的文件setup.cfg应该可以工作:

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

[nosetests]
attr=!speed=slow

这篇关于鼻子:默认情况下如何跳过测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆