Skip to content

Conversation

reiyw
Copy link
Contributor

@reiyw reiyw commented Jun 8, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

  • Does not include precompiled binaries, eg. .par files. See CONTRIBUTING.md for info
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #478

When pip-compile fails to resolve the dependency, requirements_test will pass regardless of the content of the lock file.

What is the new behavior?

When pip-compile fails to resolve the dependency, exit with an error message, and the test will fail.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@reiyw reiyw requested review from brandjon and lberki as code owners June 8, 2021 04:31
@google-cla
Copy link

google-cla bot commented Jun 8, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Jun 8, 2021
@reiyw
Copy link
Contributor Author

reiyw commented Jun 8, 2021

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Jun 8, 2021
Copy link

@thundergolfer thundergolfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested adding extra error checking, but happy with the contributed fix 🙏

sys.exit(1)
except SystemExit:
except SystemExit as e:
if e.code == 2:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improves things for sure, but still leaves us open to cases where e.code not in {0, 2}. Looking at the piptools source, it only ever exits 0 or 2, but my preference would be to check for the unexpected cases and exit(1) instead of incorrectly succeeding .

if e.code == 2:
   # handle 2
   # ...
   sys.exit(1)
elif e.code == 0:
   # handle 0
   # ...
   sys.exit(0)
else:
   # handle unexpected
   # ...
   sys.exit(1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree. I have fixed it that way.

@thundergolfer thundergolfer merged commit f1b6b74 into bazel-contrib:master Jun 9, 2021
@thundergolfer
Copy link

Thanks for the contribution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants