Skip to content

Commit 72f9841

Browse files
committed
Fixed test to use globs
1 parent 19db421 commit 72f9841

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

tests/test_bump.py

+22-14
Original file line numberDiff line numberDiff line change
@@ -371,27 +371,28 @@ def test_changes_to_files_are_committed(git_repo: Path, caplog):
371371
commit = true
372372
373373
[[tool.bumpversion.files]]
374-
filename = "helm/charts/somechart/Chart.yaml"
374+
glob = "helm/charts/*/Chart.yaml"
375375
376376
"""
377377
),
378378
encoding="utf-8",
379379
)
380-
chart_path = git_repo / "helm" / "charts" / "somechart" / "Chart.yaml"
381-
382-
chart_path.parent.mkdir(parents=True, exist_ok=True)
383-
chart_path.write_text(
384-
dedent(
385-
"""
386-
appVersion: 0.1.26
387-
version: 0.1.26
380+
chart_contents = dedent(
381+
"""
382+
appVersion: 0.1.26
383+
version: 0.1.26
388384
389-
"""
390-
)
385+
"""
391386
)
387+
chart1_path = git_repo / "helm" / "charts" / "somechart" / "Chart.yaml"
388+
chart2_path = git_repo / "helm" / "charts" / "otherchart" / "Chart.yaml"
389+
chart1_path.parent.mkdir(parents=True, exist_ok=True)
390+
chart1_path.write_text(chart_contents, encoding="utf-8")
391+
chart2_path.parent.mkdir(parents=True, exist_ok=True)
392+
chart2_path.write_text(chart_contents, encoding="utf-8")
392393

393394
with inside_dir(git_repo):
394-
run_command(["git", "add", str(chart_path), str(config_path)])
395+
run_command(["git", "add", str(chart1_path), str(chart2_path), str(config_path)])
395396
run_command(["git", "commit", "-m", "Initial commit"])
396397

397398
# Act
@@ -423,11 +424,18 @@ def test_changes_to_files_are_committed(git_repo: Path, caplog):
423424
commit = true
424425
425426
[[tool.bumpversion.files]]
426-
filename = "helm/charts/somechart/Chart.yaml"
427+
glob = "helm/charts/*/Chart.yaml"
428+
429+
"""
430+
)
431+
assert chart1_path.read_text() == dedent(
432+
"""
433+
appVersion: 0.2.0
434+
version: 0.2.0
427435
428436
"""
429437
)
430-
assert chart_path.read_text() == dedent(
438+
assert chart2_path.read_text() == dedent(
431439
"""
432440
appVersion: 0.2.0
433441
version: 0.2.0

0 commit comments

Comments
 (0)