Skip to content

Commit 60e89ce

Browse files
committed
fix: add integration test to check output of runtime mismatch
1 parent 150cf30 commit 60e89ce

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

aws_lambda_builders/exceptions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class MisMatchRuntimeError(LambdaBuilderError):
1919
MESSAGE = "{language} executable found in your path does not " \
2020
"match runtime. " \
2121
"\n Expected version: {required_runtime}, Found version: {found_runtime}. " \
22-
"\n Consider moving {required_runtime} up path hierarchy." \
2322
"\n Possibly related: https://github.com/awslabs/aws-lambda-builders/issues/30"
2423

2524

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from unittest import TestCase
77

88
from aws_lambda_builders.builder import LambdaBuilder
9-
from aws_lambda_builders.exceptions import WorkflowFailedError
9+
from aws_lambda_builders.exceptions import WorkflowFailedError, MisMatchRuntimeError
1010

1111

1212
class TestPythonPipWorkflow(TestCase):
@@ -33,6 +33,12 @@ def setUp(self):
3333
language=self.builder.capability.language,
3434
major=sys.version_info.major,
3535
minor=sys.version_info.minor)
36+
self.runtime_mismatch = {
37+
'python3.6': 'python2.7',
38+
'python3.7': 'python2.7',
39+
'python2.7': 'python3.6'
40+
41+
}
3642

3743
def tearDown(self):
3844
shutil.rmtree(self.artifacts_dir)
@@ -46,6 +52,15 @@ def test_must_build_python_project(self):
4652
output_files = set(os.listdir(self.artifacts_dir))
4753
self.assertEquals(expected_files, output_files)
4854

55+
def test_mismatch_runtime_python_project(self):
56+
with self.assertRaises(MisMatchRuntimeError) as mismatch_error:
57+
self.builder.build(self.source_dir, self.artifacts_dir, self.scratch_dir, self.manifest_path_valid,
58+
runtime=self.runtime_mismatch[self.runtime])
59+
self.assertEquals(mismatch_error.msg,
60+
MisMatchRuntimeError(language="python",
61+
required_runtime=self.runtime_mismatch[self.runtime],
62+
found_runtime=self.runtime).MESSAGE)
63+
4964
def test_runtime_validate_python_project_fail_open_unsupported_runtime(self):
5065
with self.assertRaises(WorkflowFailedError):
5166
self.builder.build(self.source_dir, self.artifacts_dir, self.scratch_dir, self.manifest_path_valid,

0 commit comments

Comments
 (0)