Skip to content

Protect custom savepath from accidental overwrite#536

Open
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:fix-savepath-overwrite-guard
Open

Protect custom savepath from accidental overwrite#536
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:fix-savepath-overwrite-guard

Conversation

@StantonMatt

@StantonMatt StantonMatt commented Jun 1, 2026

Copy link
Copy Markdown

Summary

  • apply the existing overwrite protection to the resolved output path, including custom --savepath files
  • keep --print, --diff, --clean, and stdout output from being blocked by the file-generation guard
  • add regression coverage for custom savepath no-force, force, diff, and clean behavior

Fixes #336.

Verification

  • .venv/bin/python -m unittest tests.test_pipreqs.TestPipreqs.test_init_savepath tests.test_pipreqs.TestPipreqs.test_init_overwrite tests.test_pipreqs.TestPipreqs.test_init_savepath_does_not_overwrite_existing_file_without_force tests.test_pipreqs.TestPipreqs.test_init_savepath_force_overwrites_existing_file tests.test_pipreqs.TestPipreqs.test_init_savepath_existing_file_does_not_block_diff tests.test_pipreqs.TestPipreqs.test_init_savepath_existing_file_does_not_block_clean
  • .venv/bin/python -m unittest discover
  • uv run --with flake8 flake8 pipreqs tests
  • git diff --check
  • review-fix-loop clean

Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
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.

pipreqs --savepath always overwrite despite i'm not using --force

1 participant