Skip to content

Commit e6bcaee

Browse files
committed
improve tests
1 parent f6e464f commit e6bcaee

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

test/test-python-shell.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -517,33 +517,29 @@ describe('PythonShell', function () {
517517
});
518518
});
519519

520-
describe('.terminate()', function () {
521-
it('set terminated to true', function (done) {
520+
describe('.kill()', function () {
521+
it('set terminated to correct value', function (done) {
522522
let pyshell = new PythonShell('infinite_loop.py');
523-
pyshell.terminate();
523+
pyshell.kill();
524524
pyshell.terminated.should.be.true
525525
done();
526526
});
527527
it('run the end callback if specified', function (done) {
528528
let pyshell = new PythonShell('infinite_loop.py');
529-
let endCalled = false;
530529
pyshell.end(() => {
531-
endCalled = true;
530+
done();
532531
})
533-
pyshell.terminate();
534-
pyshell.terminated.should.be.true
535-
done();
532+
pyshell.kill();
536533
});
537534
it('kill with correct signal', function (done) {
538535
let pyshell = new PythonShell('infinite_loop.py');
539-
let endCalled = false;
540-
pyshell.end(() => {
541-
endCalled = true;
542-
})
536+
pyshell.terminated.should.be.false;
543537
pyshell.kill('SIGKILL');
544538
pyshell.terminated.should.be.true;
545-
setTimeout(() => { pyshell.exitSignal.should.be.exactly('SIGKILL'); }, 500);
546-
done();
539+
setTimeout(() => {
540+
pyshell.exitSignal.should.be.exactly('SIGKILL');
541+
done();
542+
}, 500);
547543
});
548544
});
549545
});

0 commit comments

Comments
 (0)