This repository was archived by the owner on Oct 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,11 @@ function pyprojectTomlToRequirements() {
3535
3636 const editableFlag = new RegExp ( / ^ - e / gm) ;
3737 const sourceRequirements = path . join ( this . servicePath , 'requirements.txt' ) ;
38- const requirementsContents = fse . readFileSync ( sourceRequirements , {
39- encoding : 'utf-8'
40- } ) ;
38+ const requirementsContents =
39+ res . stdout . toString ( ) . trim ( ) || // As of poetry 1.0.0b1, requirements.txt is printed to standard output when the -o option is not specified.
40+ fse . readFileSync ( sourceRequirements , {
41+ encoding : 'utf-8'
42+ } ) ;
4143
4244 if ( requirementsContents . match ( editableFlag ) ) {
4345 this . serverless . cli . log (
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ const sls = mkCommand('sls');
5252const git = mkCommand ( 'git' ) ;
5353const npm = mkCommand ( 'npm' ) ;
5454const perl = mkCommand ( 'perl' ) ;
55+ const poetry = mkCommand ( 'poetry' ) ;
5556
5657const setup = ( ) => {
5758 removeSync ( getUserCachePath ( ) ) ;
@@ -1886,3 +1887,17 @@ test(
18861887 } ,
18871888 { skip : ! canUseDocker ( ) }
18881889) ;
1890+
1891+ // From this point on, the version of the poetry is 1.0.0a0
1892+ test ( 'poetry1.0.0a0 py3.6 can package flask with default options' , t => {
1893+ process . chdir ( 'tests/poetry' ) ;
1894+ const path = npm ( [ 'pack' , '../..' ] ) ;
1895+ npm ( [ 'i' , path ] ) ;
1896+ poetry ( [ 'self' , 'update' , '--preview' , '1.0.0a0' ] ) ;
1897+ sls ( [ 'package' ] ) ;
1898+ const zipfiles = listZipFiles ( '.serverless/sls-py-req-test.zip' ) ;
1899+ t . true ( zipfiles . includes ( `flask${ sep } __init__.py` ) , 'flask is packaged' ) ;
1900+ t . true ( zipfiles . includes ( `bottle.py` ) , 'bottle is packaged' ) ;
1901+ t . true ( zipfiles . includes ( `boto3${ sep } __init__.py` ) , 'boto3 is packaged' ) ;
1902+ t . end ( ) ;
1903+ } ) ;
You can’t perform that action at this time.
0 commit comments