From 45d91bf963f6358909ab1e1cc29cbbab73fe7133 Mon Sep 17 00:00:00 2001 From: Hugo Lopes Tavares Date: Tue, 16 Feb 2016 16:56:20 -0500 Subject: [PATCH] [lambda] Do not use ZipFile as a context manager (it is not supported in Python 2.6) --- tests/test_awslambda/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_awslambda/__init__.py b/tests/test_awslambda/__init__.py index cdd61db35..9fe544867 100644 --- a/tests/test_awslambda/__init__.py +++ b/tests/test_awslambda/__init__.py @@ -13,11 +13,12 @@ from moto import mock_lambda, mock_s3 def get_test_zip_file(): zip_output = io.BytesIO() - with zipfile.ZipFile(zip_output, 'w') as f: - f.writestr('lambda_function.py', b'''\ + zip_file = zipfile.ZipFile(zip_output, 'w') + zip_file.writestr('lambda_function.py', b'''\ def handler(event, context): return "hello world" ''') + zip_file.close() zip_output.seek(0) return zip_output.read()