从nosetests运行中排除特定目录。

nose-exclude的Python项目详细描述


概述

nose exclude是一个Nose插件,它允许您轻松地指定 要从测试中排除的目录。

排除目录

--exclude-dir=选项在安装 插件。此选项可以多次用于排除多个目录 从测试开始。提供的目录路径可以是绝对路径或相对路径。

示例:

$ nosetests --exclude-dir=test_dirs/build \
    --exclude-dir=test_dirs/test_not_me test_dirs
....
----------------------------------------------------------------------
Ran 4 tests in 0.006s

OK

此示例将排除目录test\u dirs/build和 从鼻测试的测试搜索中,测试方向/测试不是我。

使用基于文件的排除列表

--exclude-dir-file=选项可用于传入预定义的 文件中包含的目录列表。nose-exclude需要每个 目录被排除在自己的行上。

示例:

$ nosetests --exclude-dir-file=test_dirs/exclude_dirs.txt \
    test_dirs
....
----------------------------------------------------------------------
Ran 4 tests in 0.006s

OK

其中exclude_dirs.txt可能看起来像:

test_dirs/build
# Start a line with a '#' to include
# Comments
test_dirs/test_not_me

不包括特定的试验方法和等级

现在可以通过指定完全限定的测试路径来排除测试。 可以使用--exclude-test--exclude-test-file排除测试。

排除测试方法:

--exclude-test=module1.module2.TestClass.test_method

排除测试类:

--exclude-test=module1.module2.TestClass

排除测试功能:

--exclude-test=module1.module2.test_function

使用环境变量

--exclude-dir=--exclude-test=可以由环境设置 变量分别为NOSE_EXCLUDE_DIRSNOSE_EXCLUDE_TESTS。 可以使用;分隔多个排除路径。这个 环境变量NOSE_EXCLUDE_DIRS_FILE设置为 基于文件的排除列表函数,就好像它是随 --exclude-dir-file=

鼻配置文件

nose-exclude选项也可以使用.nosercnose.cfg文件传递给nosetests。如果要排除多个目录 使用相同的配置键用新行分隔它们的值:

[nosetests]
exclude-dir=test_dirs/exclude_dirs
            test_dirs/more_excludes

错误

请将所有错误(和修补程序)报告给https://github.com/kgrandis/nose-exclude/

注意:以前的BitBucket存储库不再是主动维护的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java将一个节点拖到另一个不运行JavaFX的节点中   java如何在spring boot中创建完全自定义的查询   java Arraylist和ArrayListBlockingQueue之间的区别是什么?   java Weblogic会中断长时间运行的线程吗   java如何调用displayAd()方法?   使用数组在两个组之间进行java IPL匹配   java如何在Eclipse中的org下创建测试套件。朱尼特   java获取屏幕上任意点的鼠标坐标   正则表达式需要java正则表达式方面的帮助   如何使用Java获取Ram大小和硬盘大小?   java如何将所需长度设置为数组中的整数?   安卓应用程序启动前的java程序已终止   swing设置要在Java代码中打印的页边距   迭代期间java故障安全迭代器的删除   java如何在main中调用方法,以便它们在同一行上输出?   编译Java:尝试播放mp3文件时出错   java如何使用Spring数据Rest在POST调用中保存嵌入对象   java JAXWS如何在端点外部注入SecurityContext