FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

#107 fixing failing unit tests on windows · Dmdv/python-shell@dccda47 · GitHub

Repository navigation

Commit dccda47

Browse files
committed
extrabacon#107 fixing failing unit tests on windows
1 parent 85fdeca commit dccda47

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎test/test-python-shell.js‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var should = require('should');
22
var PythonShell = require('..');
3+
var path = require('path')
4+
const newline = require('os').EOL
35

46
describe('PythonShell', function () {
57

@@ -10,7 +12,7 @@ describe('PythonShell', function () {
1012
describe('#ctor(script, options)', function () {
1113
it('should spawn a Python process', function (done) {
1214
var pyshell = new PythonShell('exit-code.py');
13-
pyshell.command.should.eql(['test/python/exit-code.py']);
15+
pyshell.command.should.eql(['test' + path.sep + 'python' + path.sep + 'exit-code.py']);
1416
pyshell.terminated.should.be.false;
1517
pyshell.end(function (err) {
1618
if (err) return done(err);
@@ -22,14 +24,14 @@ describe('PythonShell', function () {
2224
var pyshell = new PythonShell('exit-code.py', {
2325
pythonOptions: '-u'
2426
});
25-
pyshell.command.should.eql(['-u', 'test/python/exit-code.py']);
27+
pyshell.command.should.eql(['-u', 'test' + path.sep + 'python' + path.sep + 'exit-code.py']);
2628
pyshell.end(done);
2729
});
2830
it('should spawn a Python process with script arguments', function (done) {
2931
var pyshell = new PythonShell('echo_args.py', {
3032
args: ['hello', 'world']
3133
});
32-
pyshell.command.should.eql(['test/python/echo_args.py', 'hello', 'world']);
34+
pyshell.command.should.eql(['test' + path.sep + 'python' + path.sep + 'echo_args.py', 'hello', 'world']);
3335
pyshell.end(done);
3436
});
3537
});
@@ -119,7 +121,7 @@ describe('PythonShell', function () {
119121
});
120122
pyshell.send('hello').send('world').end(function (err) {
121123
if (err) return done(err);
122-
output.should.be.exactly('hello\nworld\n');
124+
output.should.be.exactly('hello'+newline+'world'+newline);
123125
done();
124126
});
125127
});
@@ -133,7 +135,7 @@ describe('PythonShell', function () {
133135
});
134136
pyshell.send({ a: 'b' }).send(null).send([1, 2, 3]).end(function (err) {
135137
if (err) return done(err);
136-
output.should.be.exactly('{"a": "b"}\nnull\n[1, 2, 3]\n');
138+
output.should.be.exactly('{"a": "b"}'+newline+'null'+newline+'[1, 2, 3]'+newline);
137139
done();
138140
});
139141
});
@@ -149,7 +151,7 @@ describe('PythonShell', function () {
149151
});
150152
pyshell.send('hello').send('world').end(function (err) {
151153
if (err) return done(err);
152-
output.should.be.exactly('HELLO\nWORLD\n');
154+
output.should.be.exactly('HELLO'+newline+'WORLD'+newline+'');
153155
done();
154156
});
155157
});
@@ -205,7 +207,7 @@ describe('PythonShell', function () {
205207
pyshell.on('message', function (message) {
206208
message.should.be.an.Object;
207209
message.should.eql({ a: true });
208-
}).receive('{"a"').receive(':').receive('true}\n').end(done);
210+
}).receive('{"a"').receive(':').receive('true}'+newline+'').end(done);
209211
});
210212
it('should not be invoked when mode is "binary"', function (done) {
211213
var pyshell = new PythonShell('echo_args.py', {
@@ -281,8 +283,8 @@ describe('PythonShell', function () {
281283
var pyshell = new PythonShell('error.py');
282284
pyshell.on('error', function (err) {
283285
err.stack.should.containEql('----- Python Traceback -----');
284-
err.stack.should.containEql('File "test/python/error.py", line 6');
285-
err.stack.should.containEql('File "test/python/error.py", line 4');
286+
err.stack.should.containEql('File "test' + path.sep + 'python' + path.sep + 'error.py", line 4');
287+
err.stack.should.containEql('File "test' + path.sep + 'python' + path.sep + 'error.py", line 6');
286288
done();
287289
});
288290
});

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL