@@ -1373,6 +1373,89 @@ test(
13731373 { skip : ! canUseDocker ( ) || process . platform === 'win32' }
13741374) ;
13751375
1376+ test (
1377+ 'py3.9 can package flask running in docker with module runtime & architecture of function' ,
1378+ async ( t ) => {
1379+ process . chdir ( 'tests/individually_mixed_runtime' ) ;
1380+ const path = npm ( [ 'pack' , '../..' ] ) ;
1381+ npm ( [ 'i' , path ] ) ;
1382+
1383+ sls ( [ 'package' ] , {
1384+ env : { dockerizePip : 'true' } ,
1385+ } ) ;
1386+
1387+ const zipfiles_hello2 = await listZipFiles (
1388+ '.serverless/module2-sls-py-req-test-indiv-mixed-runtime-dev-hello2.zip'
1389+ ) ;
1390+ t . true (
1391+ zipfiles_hello2 . includes ( 'handler2.py' ) ,
1392+ 'handler2.py is packaged at root level in function hello2'
1393+ ) ;
1394+ t . true (
1395+ zipfiles_hello2 . includes ( `flask${ sep } __init__.py` ) ,
1396+ 'flask is packaged in function hello2'
1397+ ) ;
1398+ } ,
1399+ {
1400+ skip : ! canUseDocker ( ) || process . platform === 'win32' ,
1401+ }
1402+ ) ;
1403+
1404+ test (
1405+ 'py3.9 can package flask succesfully when using mixed architecture, docker and zipping' ,
1406+ async ( t ) => {
1407+ process . chdir ( 'tests/individually_mixed_runtime' ) ;
1408+ const path = npm ( [ 'pack' , '../..' ] ) ;
1409+
1410+ npm ( [ 'i' , path ] ) ;
1411+ sls ( [ 'package' ] , { env : { dockerizePip : 'true' , zip : 'true' } } ) ;
1412+
1413+ const zipfiles_hello = await listZipFiles ( '.serverless/hello1.zip' ) ;
1414+ t . true (
1415+ zipfiles_hello . includes ( `module1${ sep } handler1.ts` ) ,
1416+ 'handler1.ts is packaged in module dir for hello1'
1417+ ) ;
1418+ t . false (
1419+ zipfiles_hello . includes ( 'handler2.py' ) ,
1420+ 'handler2.py is NOT packaged at root level in function hello1'
1421+ ) ;
1422+ t . false (
1423+ zipfiles_hello . includes ( `flask${ sep } __init__.py` ) ,
1424+ 'flask is NOT packaged in function hello1'
1425+ ) ;
1426+
1427+ const zipfiles_hello2 = await listZipFiles (
1428+ '.serverless/module2-sls-py-req-test-indiv-mixed-runtime-dev-hello2.zip'
1429+ ) ;
1430+ const zippedReqs = await listRequirementsZipFiles (
1431+ '.serverless/module2-sls-py-req-test-indiv-mixed-runtime-dev-hello2.zip'
1432+ ) ;
1433+ t . true (
1434+ zipfiles_hello2 . includes ( 'handler2.py' ) ,
1435+ 'handler2.py is packaged at root level in function hello2'
1436+ ) ;
1437+ t . false (
1438+ zipfiles_hello2 . includes ( `module1${ sep } handler1.ts` ) ,
1439+ 'handler1.ts is NOT included at module1 level in hello2'
1440+ ) ;
1441+ t . false (
1442+ zipfiles_hello2 . includes ( `pyaml${ sep } __init__.py` ) ,
1443+ 'pyaml is NOT packaged in function hello2'
1444+ ) ;
1445+ t . false (
1446+ zipfiles_hello2 . includes ( `boto3${ sep } __init__.py` ) ,
1447+ 'boto3 is NOT included in zipfile'
1448+ ) ;
1449+ t . true (
1450+ zippedReqs . includes ( `flask${ sep } __init__.py` ) ,
1451+ 'flask is packaged in function hello2 in requirements.zip'
1452+ ) ;
1453+
1454+ t . end ( ) ;
1455+ } ,
1456+ { skip : ! canUseDocker ( ) || process . platform === 'win32' }
1457+ ) ;
1458+
13761459test (
13771460 'py3.9 uses download cache by default option' ,
13781461 async ( t ) => {
0 commit comments