Non-matching glob patterns don't raise `FileNotFoundError`
Opened this issue · 0 comments
- bump-my-version version:
0.18.1
- Python version:
3.12.2
- Operating System: macOS 14.3.1
Description
I expect glob
patterns to raise a FileNotFoundError
if the pattern do not match any existing file.
I discovered this issue while playing with the new --ignore-missing-files
parameter (see #38 and #138).
What I Did
Given this pyproject.toml
file in an empty directory:
[tool.bumpversion]
current_version = "3.7.0"
[[tool.bumpversion.files]]
glob = "./**/*requirements.txt"
A call to a bump
action runs without issue:
❯ bump-my-version --verbose bump minor
Starting BumpVersion 0.18.1
Reading configuration
Reading config file: /Users/kde/bump_test/pyproject.toml
Parsing current version '3.7.0'
Attempting to increment part 'minor'
Values are now: major=3, minor=8, patch=0
New version will be '3.8.0'
Processing config file: /Users/kde/bump_test/pyproject.toml
Found '3\.7\.0' at line 1: 3.7.0
Changing file /Users/kde/bump_test/pyproject.toml:tool.bumpversion.current_version:
*** before /Users/kde/bump_test/pyproject.toml:tool.bumpversion.current_version
--- after /Users/kde/bump_test/pyproject.toml:tool.bumpversion.current_version
***************
*** 1 ****
! 3.7.0
--- 1 ----
! 3.8.0
Done.
Instead, I expect the command above to raise a FileNotFoundError
, because there is no file matching the glob = "./**/*requirements.txt"
pattern.
I.e. I expect the CLI to behave the same as it currently does with a standard filename =
option. A consequence would for the --ignore-missing-files
parameter to have the same effect on glob
patterns and filename
parameter (so I would need --ignore-missing-files
to reproduce the non-raising command above).