Skip to content

fix: fail the bundle when installing the root package fails - #173

Open
RaphaelFakhri wants to merge 1 commit into
python-poetry:mainfrom
RaphaelFakhri:fix/fail-on-root-install-error
Open

RaphaelFakhri wants to merge 1 commit into
python-poetry:mainfrom
RaphaelFakhri:fix/fail-on-root-install-error

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Pull Request Check List

Resolves: #134

  • Added tests for changed code.
  • Updated documentation for changed code.

Summary

VenvBundler.bundle() ignores the return code of installer.executor.execute([Install(package)]) when it installs the root package. The executor catches installation errors and only prints them at -vvv, so a failed root install still prints Bundled ... and the command exits with 0. The bundle then lacks the project code.

This change checks the return code. On failure, the bundler prints Failed at step Installing <name> (<version>) and returns False, so poetry bundle venv exits with 1. This matches the existing behavior when the dependency installation step fails.

Reproduction

With the pyproject.toml from #134 (script test-script = "test.test-script:main"), poetry bundle venv /tmp/venv:

  • Before: prints Bundled test (0.1.0) into /tmp/venv, exit code 0, test is missing from site-packages.
  • After: prints Failed at step Installing test (0.1.0), exit code 1.

Tests

test_bundler_should_fail_when_root_package_installation_fails makes only the root package installation raise. It fails without the fix and passes with it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception swallowed on incorrect script definitions

1 participant