nose framework command line regex pattern matching doesnt work(-e,-m ,-i)(鼻子框架命令行正则表达式模式匹配不起作用(-e,-m,-i))
问题描述
python 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 don't seem to be working correctly.
[kiran@my_redhat test]$ nosetests -w cases/ -s -v -m='_size'
----------------------------------------------------------------------
Ran 0 tests in 0.001s
OK
[kiran@my_redhat test]$ grep '_size' cases/test_case_4.py
def test_fn_size_sha(self):
鼻子框架的正则表达式匹配语义有什么问题吗?
is there some thing wrong with regex matching semantics of nose framework?
推荐答案
Nosetests' -m 参数用于匹配目录、文件名、类和函数.(查看这个参数的nose docs解释)你的情况,您的测试文件的文件名(test_case_4.py)与-m匹配表达式(_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 plugin,在默认的nose安装中可用.您可能还想尝试排除匹配某些模式的测试.
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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:鼻子框架命令行正则表达式模式匹配不起作用(-e,-m,-i)
基础教程推荐
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 筛选NumPy数组 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01