Skip to content

Commit 090710f

Browse files
authored
Merge pull request #53 from oss-serverless/additional-python-tests
Add missing tests for local invoke for non-EOL python runtimes
2 parents e59fe62 + bf4fd62 commit 090710f

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/unit/lib/plugins/aws/invoke-local/index.test.js

+44
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,28 @@ describe('AwsInvokeLocal', () => {
440440
).to.be.equal(true);
441441
});
442442

443+
it('should call invokeLocalPython when python3.9 runtime is set', async () => {
444+
awsInvokeLocal.options.functionObj.runtime = 'python3.9';
445+
await awsInvokeLocal.invokeLocal();
446+
// NOTE: this is important so that tests on Windows won't fail
447+
const runtime = process.platform === 'win32' ? 'python.exe' : 'python3.9';
448+
expect(invokeLocalPythonStub.calledOnce).to.be.equal(true);
449+
expect(
450+
invokeLocalPythonStub.calledWithExactly(runtime, 'handler', 'hello', {}, undefined)
451+
).to.be.equal(true);
452+
});
453+
454+
it('should call invokeLocalPython when python3.10 runtime is set', async () => {
455+
awsInvokeLocal.options.functionObj.runtime = 'python3.10';
456+
await awsInvokeLocal.invokeLocal();
457+
// NOTE: this is important so that tests on Windows won't fail
458+
const runtime = process.platform === 'win32' ? 'python.exe' : 'python3.10';
459+
expect(invokeLocalPythonStub.calledOnce).to.be.equal(true);
460+
expect(
461+
invokeLocalPythonStub.calledWithExactly(runtime, 'handler', 'hello', {}, undefined)
462+
).to.be.equal(true);
463+
});
464+
443465
it('should call invokeLocalPython when python3.11 runtime is set', async () => {
444466
awsInvokeLocal.options.functionObj.runtime = 'python3.11';
445467
await awsInvokeLocal.invokeLocal();
@@ -451,6 +473,28 @@ describe('AwsInvokeLocal', () => {
451473
).to.be.equal(true);
452474
});
453475

476+
it('should call invokeLocalPython when python3.12 runtime is set', async () => {
477+
awsInvokeLocal.options.functionObj.runtime = 'python3.12';
478+
await awsInvokeLocal.invokeLocal();
479+
// NOTE: this is important so that tests on Windows won't fail
480+
const runtime = process.platform === 'win32' ? 'python.exe' : 'python3.12';
481+
expect(invokeLocalPythonStub.calledOnce).to.be.equal(true);
482+
expect(
483+
invokeLocalPythonStub.calledWithExactly(runtime, 'handler', 'hello', {}, undefined)
484+
).to.be.equal(true);
485+
});
486+
487+
it('should call invokeLocalPython when python3.13 runtime is set', async () => {
488+
awsInvokeLocal.options.functionObj.runtime = 'python3.13';
489+
await awsInvokeLocal.invokeLocal();
490+
// NOTE: this is important so that tests on Windows won't fail
491+
const runtime = process.platform === 'win32' ? 'python.exe' : 'python3.13';
492+
expect(invokeLocalPythonStub.calledOnce).to.be.equal(true);
493+
expect(
494+
invokeLocalPythonStub.calledWithExactly(runtime, 'handler', 'hello', {}, undefined)
495+
).to.be.equal(true);
496+
});
497+
454498
it('should call invokeLocalJava when java8 runtime is set', async () => {
455499
awsInvokeLocal.options.functionObj.runtime = 'java8';
456500
await awsInvokeLocal.invokeLocal();

0 commit comments

Comments
 (0)