@@ -632,47 +632,26 @@ MarkupSafe==2.0.1
632632 })
633633
634634 Describe ("InstallCommonBuildDependencies" , func () {
635- var bpDir string
636-
637- BeforeEach (func () {
638- bpDir , err = os .MkdirTemp ("" , "python-buildpack.bp." )
639- Expect (err ).To (BeNil ())
640- DeferCleanup (os .RemoveAll , bpDir )
641- // Create the vendor_bundled directory with a dummy poetry-core tarball
642- Expect (os .MkdirAll (filepath .Join (bpDir , "vendor_bundled" ), 0755 )).To (Succeed ())
643- Expect (os .WriteFile (filepath .Join (bpDir , "vendor_bundled" , "poetry-core_2.1.3.tgz" ), []byte ("dummy" ), 0644 )).To (Succeed ())
644- // GetBuildpackDir() reads BUILDPACK_DIR env var if set
645- os .Setenv ("BUILDPACK_DIR" , bpDir )
646- DeferCleanup (os .Unsetenv , "BUILDPACK_DIR" )
647- })
648-
649635 Context ("successful installation" , func () {
650- It ("bootstraps flit-core, wheel, setuptools and poetry-core" , func () {
651- // Step 1+2: install pip and flit-core dependency tarballs
636+ It ("bootstraps flit-core, wheel and setuptools" , func () {
652637 mockInstaller .EXPECT ().InstallOnlyVersion ("pip" , "/tmp/common_build_deps" )
653638 mockInstaller .EXPECT ().InstallOnlyVersion ("flit-core" , "/tmp/common_build_deps" )
654- // Step 4: bootstrap flit_core from source
655639 mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "/tmp/common_build_deps" , "--no-build-isolation" )
656- // Step 5: install wheel and setuptools
657640 mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "wheel" , "--no-index" , "--no-build-isolation" , "--upgrade-strategy=only-if-needed" , "--find-links=/tmp/common_build_deps" )
658641 mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "setuptools" , "--no-index" , "--no-build-isolation" , "--upgrade-strategy=only-if-needed" , "--find-links=/tmp/common_build_deps" )
659- // Step 6: extract and bootstrap poetry-core
660- poetryCoreTar := filepath .Join (bpDir , "vendor_bundled" , "poetry-core_2.1.3.tgz" )
661- mockCommand .EXPECT ().Execute ("/" , gomock .Any (), gomock .Any (), "tar" , "xzf" , poetryCoreTar , "-C" , "/tmp/poetry_core_src" )
662- mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "/tmp/poetry_core_src" , "--no-build-isolation" )
663642
664643 Expect (supplier .InstallCommonBuildDependencies ()).To (Succeed ())
665644 })
666645 })
667646
668- Context ("flit-core bootstrap fails" , func () {
669- It ("returns a useful error message" , func () {
670- mockInstaller .EXPECT ().InstallOnlyVersion ("pip" , "/tmp/common_build_deps" )
671- mockInstaller .EXPECT ().InstallOnlyVersion ("flit-core" , "/tmp/common_build_deps" )
672- mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "/tmp/common_build_deps" , "--no-build-isolation" ).Return (fmt .Errorf ("bootstrap-error" ))
673- Expect (supplier .InstallCommonBuildDependencies ()).To (MatchError ("could not bootstrap-install flit-core: bootstrap-error" ))
674- })
647+ Context ("flit-core bootstrap fails" , func () {
648+ It ("returns a useful error message" , func () {
649+ mockInstaller .EXPECT ().InstallOnlyVersion ("pip" , "/tmp/common_build_deps" )
650+ mockInstaller .EXPECT ().InstallOnlyVersion ("flit-core" , "/tmp/common_build_deps" )
651+ mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "/tmp/common_build_deps" , "--no-build-isolation" ).Return (fmt .Errorf ("bootstrap-error" ))
652+ Expect (supplier .InstallCommonBuildDependencies ()).To (MatchError ("could not bootstrap-install flit-core: bootstrap-error" ))
675653 })
654+ })
676655
677656 Context ("wheel installation fails" , func () {
678657 It ("returns a useful error message" , func () {
@@ -683,20 +662,6 @@ MarkupSafe==2.0.1
683662 Expect (supplier .InstallCommonBuildDependencies ()).To (MatchError ("could not install build-time dependency wheel: some-pip-error" ))
684663 })
685664 })
686-
687- Context ("poetry-core bootstrap fails" , func () {
688- It ("returns a useful error message" , func () {
689- mockInstaller .EXPECT ().InstallOnlyVersion ("pip" , "/tmp/common_build_deps" )
690- mockInstaller .EXPECT ().InstallOnlyVersion ("flit-core" , "/tmp/common_build_deps" )
691- mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "/tmp/common_build_deps" , "--no-build-isolation" )
692- mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "wheel" , "--no-index" , "--no-build-isolation" , "--upgrade-strategy=only-if-needed" , "--find-links=/tmp/common_build_deps" )
693- mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "setuptools" , "--no-index" , "--no-build-isolation" , "--upgrade-strategy=only-if-needed" , "--find-links=/tmp/common_build_deps" )
694- poetryCoreTar := filepath .Join (bpDir , "vendor_bundled" , "poetry-core_2.1.3.tgz" )
695- mockCommand .EXPECT ().Execute ("/" , gomock .Any (), gomock .Any (), "tar" , "xzf" , poetryCoreTar , "-C" , "/tmp/poetry_core_src" )
696- mockCommand .EXPECT ().Execute (buildDir , gomock .Any (), gomock .Any (), "python" , "-m" , "pip" , "install" , "/tmp/poetry_core_src" , "--no-build-isolation" ).Return (fmt .Errorf ("poetry-error" ))
697- Expect (supplier .InstallCommonBuildDependencies ()).To (MatchError ("could not bootstrap-install poetry-core: poetry-error" ))
698- })
699- })
700665 })
701666
702667 Describe ("CreateDefaultEnv" , func () {
0 commit comments