0

我使用 grunt 和Gruntfile.js监视文件和启动测试,像这样

// Gruntfile.js
module.exports = function(grunt){
    grunt.initConfig({
        watch: {
            grunt: {
                files: ['Gruntfile.js']
            },
            python: {
                files : ['./tests/*.py','./libs/*/*.py'],
                tasks: ['pythontest'],
            },
        }
    });

    grunt.registerTask('pythontest', function(){
        grunt.util.spawn({
            cmd: 'python',
            args: ['setup.py','test'],
            opts: {stdio: 'inherit'},
        });
    });

    grunt.registerTask('default', ['watch']);

};

我正在搜索 python 解决方案,例如watchdog

对于任务和命令的定义,看门狗有一些类似的文件Gruntfile.js

4

1 回答 1

0

对于单个命令,使用安装在 Python模块中的watchmedo脚本命令:watchdog

watchmedo shell-command --patterns="*.py" --recursive --command='echo python setup.py test # "${watch_src_path}"'
于 2014-08-18T21:04:45.240 回答