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

Non-matching glob patterns don't raise FileNotFoundError #146

Open
kdeldycke opened this issue Feb 25, 2024 · 0 comments
Open

Non-matching glob patterns don't raise FileNotFoundError #146

kdeldycke opened this issue Feb 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kdeldycke
Copy link
Collaborator

  • 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).

@kdeldycke kdeldycke added the bug Something isn't working label Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant