鼻子框架命令行正则表达式模式匹配不工作(-e,-m,-i) [英] nose framework command line regex pattern matching doesnt work(-e,-m ,-i)

查看:235
本文介绍了鼻子框架命令行正则表达式模式匹配不工作(-e,-m,-i)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

蟒蛇nosetest框架有一些命令行选项包括,排除和匹配的正则表达式可以包含/排除和分别匹配测试。

the python nosetest framework has some command line options to include , exclude and match regex for tests which can be included/excluded and matched respectively.

但他们不似乎正常工作。

however they dont seem to be working correctly.

[基兰@ my_redhat测试] $ nosetests -w例/ -s -v -m ='_大小

[kiran@my_redhat test]$ nosetests -w cases/ -s -v -m='_size'

0冉在测试0.001S

Ran 0 tests in 0.001s

确定

[基兰@ my_redhat测试] $ grep'可以_size例/ test_case_4.py

[kiran@my_redhat test]$ grep '_size' cases/test_case_4.py

高清test_fn_size_sha(个体经营):

def test_fn_size_sha(self):

[基兰@ my_redhat测试] $

[kiran@my_redhat test]$

有一些东西不对鼻子框架的正则表达式匹配语义?

is there some thing wrong with regex matching semantics of nose framework?

推荐答案

Nosetests'-m参数是用来匹配的目录,文件名,类和功能。 (查看此参数鼻子文档的解释),根据你的情况,对你的文件名测试文件(test_case_4.py)不匹配-m比赛前pression(_size),所以从不打开。

Nosetests' -m argument is used to match directories, filenames, classes, and functions. (See the nose docs explanation of this parameter) In your case, the filename of your test file (test_case_4.py) does not match the -m match expression (_size), so is never opened.

您可能会注意到,如果你的鼻子强行打开你的测试文件,它的将会的只运行指定的测试:

You may notice that if you force nose to open your test file, it will run only the specified test:

nosetests -sv -m='_size' cases/test_case_4.py

在一般情况下,当我想匹配我使用 --attrib插件测试,具体测试或子集,这是可以在默认安装的鼻子。你也可以尝试排除匹配某种模式的测试。

In general, when I want to match specific tests or subsets of tests I use the --attrib plugin, which is available in the default nose install. You may also want to try excluding tests that match some pattern.

这篇关于鼻子框架命令行正则表达式模式匹配不工作(-e,-m,-i)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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