Gulp task runner to run python nosetests

// -*- coding: utf-8 -*-
var fs = require('fs');
var gulp = require('gulp');
var child_process = require('child_process');
 
gulp.task('test', function (){
    var status = 'stop';
    var cmd = 'nosetests';
    var targets = [
        'src/**/*.py',
        'tests/**/*.py'
    ];
 
    var testing = (function (event){
        console.log('run: ' +  event.path);
        if(status != 'running'){
            status = 'running';
            var child = child_process.exec(cmd, function (err, stdout, stderr){
                if (!err){
                    console.log('stdout: ' + stdout);
                    console.log('stderr: ' + stderr)
                } else {
                    console.log(err);
                    // err.code will be the exit code of the child process
                    console.log(err.code);
                    // err.signal will be set to the signal that terminated the process
                    console.log(err.signal);
                }
                status = 'stop';
            });
        };
    });
 
    gulp.watch(targets, function (event){
        testing(event);
    });
});
 
gulp.task('default', function (){
    gulp.run('test');
});

Recommended Posts

Gulp task runner to run python nosetests
How to run Notepad ++ Python
How to run a Maya Python script
Updated to Python 2.7.9
Put MicroPython on Windows to run ESP32 on Python
Type Python scripts to run in QGIS Processing
How to run MeCab on Ubuntu 18.04 LTS Python
How to run Leap Motion in non-Apple Python
Run Python on Apache to view InfluxDB data
"Backport" to python 2
[Python] How to run Jupyter-notebook + pandas + multiprocessing (Pool) [pandas] Memo
How to run python in virtual space (for MacOS)
How to run tests in bulk with Python unittest
Create a plugin to run Python Doctest in Vim (2)
Create a plugin to run Python Doctest in Vim (1)
A memorandum to run a python script in a bat file
How to run setUp only once in python unittest
I want to run a quantum computer with Python
How to install Python
Run prepDE.py with python3
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Rewrite Python2 code to Python3 (2to3)
How to install python
python decorator to retry
Run python from excel
Introduction to Python language
Run Blender with python
Introduction to OpenCV (python)-(2)
Note to daemonize python
Introducing Python 2.7 to CentOS 6.6
Connect python to mysql
[Python MinMaxScaler] Normalize to 0 ~ 1
Cloud Run tutorial (python)
Run iperf with python
How to run a Python file at a Windows 10 command prompt
How to run a Python program from within a shell script
How to run an app built with Python + py2app built with Anaconda
Get Python scripts to run quickly in Cloud Run using responder
I want to be able to run Python in VS Code