Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure --dry-run option doesn't update poetry.lock for add, update and remove #5718

Merged
merged 3 commits into from
May 29, 2022
Merged

Ensure --dry-run option doesn't update poetry.lock for add, update and remove #5718

merged 3 commits into from
May 29, 2022

Conversation

mkniewallner
Copy link
Member

@mkniewallner mkniewallner commented May 29, 2022

Pull Request Check List

Resolves: #3666
Resolves: #3766

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

Update logic of _write_lock_file to ensure that --dry-run option of add, update and remove commands leave poetry.lock intact.

This supersedes #3767, since it has become stale, while adding missing tests for --dry-run arguments on the commands.

def _write_lock_file(self, repo: Repository, force: bool = True) -> None:
if force or (self._update and self._write_lock):
def _write_lock_file(self, repo: Repository, force: bool = False) -> None:
if self._write_lock and (force or self._update):
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a suggestion from @radoering here, and looking at the usage of the method, it does seem that the only place where we use force leaves _write_lock to True, so this seems to make sense.


tester.execute("cachy --dry-run")
tester.execute("cachy")
Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the test here because since we're testing a keyboard interrupt, it may be nice to test that the non-dry-run variant prevents updates on the files.

@mkniewallner mkniewallner marked this pull request as ready for review May 29, 2022 18:15
@neersighted neersighted merged commit 6a6034e into python-poetry:master May 29, 2022
@mkniewallner mkniewallner deleted the fix-dry-run-option-add-update-remove branch May 29, 2022 18:48
@mkniewallner mkniewallner mentioned this pull request May 29, 2022
@abn abn mentioned this pull request Jun 6, 2022
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

poetry update --dry-run modifies poetry.lock poetry remove --dry-run modifies poetry.lock
2 participants