Skip to content

Commit a20a209

Browse files
committed
Add test case for modules with zip option
1 parent 5614ab0 commit a20a209

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

test.bats

+20
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,26 @@ teardown() {
376376
! ls puck2/pyaml
377377
}
378378

379+
@test "py2.7 can package module requirements with zip option" {
380+
cd tests/individually
381+
npm i $(npm pack ../..)
382+
sls --zip=true --runtime=python2.7 package
383+
unzip .serverless/hello1.zip -d puck
384+
unzip .serverless/hello2.zip -d puck2
385+
ls puck/.requirements.zip puck/unzip_requirements.py
386+
ls puck2/.requirements.zip puck2/unzip_requirements.py
387+
}
388+
389+
@test "py3.6 can package module requirements with zip option" {
390+
cd tests/individually
391+
npm i $(npm pack ../..)
392+
sls --zip=true package
393+
unzip .serverless/hello1.zip -d puck
394+
unzip .serverless/hello2.zip -d puck2
395+
ls puck/.requirements.zip puck/unzip_requirements.py
396+
ls puck2/.requirements.zip puck2/unzip_requirements.py
397+
}
398+
379399
@test "py3.6 can package lambda-decorators using vendor option" {
380400
cd tests/base
381401
npm i $(npm pack ../..)

tests/individually/serverless.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ service: sls-py-req-test-indiv
22

33
provider:
44
name: aws
5-
runtime: python3.6
5+
runtime: ${opt:runtime, 'python3.6'}
66

77
package:
88
individually: true
99

10+
custom:
11+
pythonRequirements:
12+
zip: ${opt:zip, self:custom.defaults.zip}
13+
defaults:
14+
zip: false
15+
1016
functions:
1117
hello1:
1218
handler: handler1.hello

0 commit comments

Comments
 (0)