@@ -142,6 +142,61 @@ test('py3.6 can package flask with slim option', t => {
142
142
t . end ( ) ;
143
143
} ) ;
144
144
145
+ test ( 'can package individually without moving modules to root of zip-File' , t => {
146
+ process . chdir ( 'tests/base' ) ;
147
+ const path = npm ( [ 'pack' , '../..' ] ) ;
148
+ npm ( [ 'i' , path ] ) ;
149
+ sls ( [ '--individually=true' , '--moveup=false' , 'package' ] ) ;
150
+
151
+ const zipfiles_hello = listZipFiles ( '.serverless/hello.zip' ) ;
152
+ t . false (
153
+ zipfiles_hello . includes ( `fn2${ sep } __init__.py` ) ,
154
+ 'fn2 is not packaged in function hello'
155
+ ) ;
156
+ t . true (
157
+ zipfiles_hello . includes ( 'handler.py' ) ,
158
+ 'handler.py is packaged in function hello'
159
+ ) ;
160
+ t . false (
161
+ zipfiles_hello . includes ( `dataclasses.py` ) ,
162
+ 'dataclasses is not packaged in function hello'
163
+ ) ;
164
+ t . true (
165
+ zipfiles_hello . includes ( `flask${ sep } __init__.py` ) ,
166
+ 'flask is packaged in function hello'
167
+ ) ;
168
+
169
+ const zipfiles_hello4 = listZipFiles ( '.serverless/hello4.zip' ) ;
170
+ t . true (
171
+ zipfiles_hello4 . includes ( `fn2${ sep } __init__.py` ) ,
172
+ 'fn2 is packaged as module in function hello4'
173
+ ) ;
174
+ t . true (
175
+ zipfiles_hello4 . includes ( `dataclasses.py` ) ,
176
+ 'dataclasses is packaged in function hello4'
177
+ ) ;
178
+ t . false (
179
+ zipfiles_hello4 . includes ( `flask${ sep } __init__.py` ) ,
180
+ 'flask is not packaged in function hello4'
181
+ ) ;
182
+
183
+ const zipfiles_hello5 = listZipFiles ( '.serverless/hello5.zip' ) ;
184
+ t . true (
185
+ zipfiles_hello5 . includes ( `fn2${ sep } __init__.py` ) ,
186
+ 'fn2 is packaged as module in function hello5'
187
+ ) ;
188
+ t . true (
189
+ zipfiles_hello5 . includes ( `dataclasses.py` ) ,
190
+ 'dataclasses is packaged in function hello5'
191
+ ) ;
192
+ t . false (
193
+ zipfiles_hello5 . includes ( `flask${ sep } __init__.py` ) ,
194
+ 'flask is not packaged in function hello5'
195
+ ) ;
196
+
197
+ t . end ( ) ;
198
+ } ) ;
199
+
145
200
/*
146
201
* News tests not in test.bats
147
202
*/
0 commit comments