每当文件更改时运行测试

arv.autotest的Python项目详细描述


简介

监视文件更改(事件)和触发器的简单应用程序 响应程序的执行。它正在与ci一起开发 记住,但也可以用于其他目的。

te程序处于pre-alpha状态,但其功能足以测试 本身。

安装

https://travis-ci.org/patxoca/arv.autotest.svg?branch=master

这个程序已经用Python2.6、2.7、3.3i 3.4进行了测试。

pip install arv.autotest

内部概述

  • 监视器为更改设置文件/目录(pynotify
  • 决定要处理的事件(event_filters.py)。过滤器 可以按类型删除事件,因为事件将变快等。 这里实施的是拥挤。
  • 执行命令以响应(runner.py
  • 处理命令(reporters)的输出。
    • 在屏幕上显示输出
    • 完成时显示通知
    • 有一个概念证明预处理器,可以修改 输出(忽略并突出显示行)。
    • 动态调整喉道

配置文件

下面的示例是由^{tt5}使用的配置文件$ 测试自身:

{
    "command": "nosetests --verbosity=2",
    "global_ignore": ["\\..*"],
    "watch"  : [
        {
            "path"    : "arv",
            "include" : [".*\\.py"]
        },
        {
            "path"    : "tests",
            "include" : ["test_.*\\.py"]
        }
    ]
}

command键中指定的命令将在 在监视的任何文件(匹配的文件)中检测到更改 *.pyarv目录中以及那些匹配的 test_*.pytests目录中)。与任何 global_ignore模式(示例中隐藏的文件)将是 忽略。

为了确定是否处理或忽略事件:

  1. 如果文件名与global_ignoreregex中的任何一个匹配,则 忽略事件。使用此选项可忽略临时文件、VCS 文件等
  2. 寻找最特别的手表 匹配路径:
    1. 如果文件名与任何对应的^{tt13}匹配$ 模式事件被忽略。
    2. 如果文件匹配任何include模式,则事件为 处理。
    3. 否则将被忽略。

配置选项

顶级选项:

command:string, required. Command to be executed on every file change.
watch:a list of watches. See below.
global_ignore:a list of regexes (strings), optional. If a file name (not path) matches any regex the events related to that file are ignored.
throttling:See below.
peprocessor:A list of directives. See below.

观看选项:

path:string, required. Path of the directory.
recurse:boolean, default ^{tt15}$. If ^{tt15}$ sub-directories will be monitored recursively.
auto_add:boolean, default ^{tt15}$. If ^{tt15}$ newly created sub-directories will be automatically monitored.
include:list of regexes (strings). Regexes matching included files.
exclude:list of regexes (strings). Regexes matching excluded files.

预处理器选项:

regex:

regular expression. If the regex matches the whole line the corresponding action i executed.

action:

action identifier. Currently two actions are defined:

  • ^{tt19}$: remove the line from the output
  • ^{tt20}$: highlight the line in red

限制选项:

max_events_second:
limit the maximum number of events that will be processed per second.

关于regex

正则表达式是re正则表达式,而不是shell全局。使用.* 不是*

正则表达式与文件名而不是路径匹配。

$添加到正则表达式的末尾,因此test_.*\\.py将 匹配test_foo.py,但不匹配test_foo.py.bak。使用 test_.*\\.py.*匹配两者。

小心斜杠,json加载程序要求它们 逃跑了(加倍)。

联系信息

Alexis Roda,^ {A2}

如果你发现一个有进步的小虫子,你可以把它扔下去 电子邮件。

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

推荐PyPI第三方库


热门话题
java ParsePushReceiver参数   java如何从设备读取完整数据?   java将java_设置为home,但忽略错误   java如何从歌曲中对专辑进行排序?   java libnaude+windows 10 x64+Eclipse   java如何将maven目标更改为如图所示的想法中的quickicon?   java swing布局中心面板,可滚动显示多个窗口窗格   使用MOSQUITO代理的mqtt中的java SSL   java如何通过属性值获取XML字符串   java在服务器每次启动时停止GWT编译   java如何让javac搜索类路径的子目录?   可以比较java中的两个不同类吗?   JAVAAndroid活动内部类中的lang.NoClassDefFoundError   java HttpServletRequest获取请求头参数块   C++socket与java客户端的连接   java如何在Apache commons http客户端上使用SSL客户端证书   使用预编译正则表达式模式提高java速度   JavaRhino将两个已编译脚本合并为一个脚本