var should = require('should'); var PythonShell = require('..'); describe('PythonShell', function () { PythonShell.defaultOptions = { scriptPath: './test/python' }; describe('#ctor(script, options)', function () { it('should spawn a Python process', function (done) { var pyshell = new PythonShell('exit-code.py'); pyshell.command.should.eql(['test/python/exit-code.py']); pyshell.terminated.should.be.false; pyshell.end(function (err) { if (err) return done(err); pyshell.terminated.should.be.true; done(); }); }); it('should spawn a Python process with options', function (done) { var pyshell = new PythonShell('exit-code.py', { pythonOptions: '-u' }); pyshell.command.should.eql(['-u', 'test/python/exit-code.py']); pyshell.end(done); }); it('should spawn a Python process with script arguments', function (done) { var pyshell = new PythonShell('echo_args.py', { args: ['hello', 'world'] }); pyshell.command.should.eql(['test/python/echo_args.py', 'hello', 'world']); pyshell.end(done); }); }); describe('#run(script, options)', function () { it('should run the script and return output d