mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 06:20:08 +01:00
allow globs in file_patterns
This commit is contained in:
parent
710019ee44
commit
1e633a2a7d
10 changed files with 136 additions and 43 deletions
|
|
@ -1,5 +1,8 @@
|
|||
from pycalver import config
|
||||
from pycalver import rewrite
|
||||
|
||||
from . import util
|
||||
|
||||
|
||||
REWRITE_FIXTURE = """
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
|
@ -29,3 +32,38 @@ def test_rewrite_final():
|
|||
assert "v201911.0003" not in "\n".join(old_lines)
|
||||
assert "None" not in "\n".join(new_lines)
|
||||
assert "v201911.0003-final" in "\n".join(new_lines)
|
||||
|
||||
|
||||
def test_iter_file_paths():
|
||||
with util.Project(project="a") as project:
|
||||
ctx = config.init_project_ctx(project.dir)
|
||||
cfg = config.parse(ctx)
|
||||
assert cfg
|
||||
|
||||
file_paths = {
|
||||
str(file_path) for file_path, patterns in rewrite._iter_file_paths(cfg.file_patterns)
|
||||
}
|
||||
|
||||
assert file_paths == {
|
||||
"pycalver.toml",
|
||||
"README.md",
|
||||
}
|
||||
|
||||
|
||||
def test_iter_file_globs():
|
||||
with util.Project(project="b") as project:
|
||||
ctx = config.init_project_ctx(project.dir)
|
||||
cfg = config.parse(ctx)
|
||||
assert cfg
|
||||
|
||||
file_paths = {
|
||||
str(file_path) for file_path, patterns in rewrite._iter_file_paths(cfg.file_patterns)
|
||||
}
|
||||
|
||||
assert file_paths == {
|
||||
"setup.cfg",
|
||||
"setup.py",
|
||||
"README.rst",
|
||||
"src/module_v1/__init__.py",
|
||||
"src/module_v2/__init__.py",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue