Skip to content

Commit

Permalink
Fixed test to use globs
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Aug 7, 2024
1 parent 19db421 commit 72f9841
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions tests/test_bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,27 +371,28 @@ def test_changes_to_files_are_committed(git_repo: Path, caplog):
commit = true
[[tool.bumpversion.files]]
filename = "helm/charts/somechart/Chart.yaml"
glob = "helm/charts/*/Chart.yaml"
"""
),
encoding="utf-8",
)
chart_path = git_repo / "helm" / "charts" / "somechart" / "Chart.yaml"

chart_path.parent.mkdir(parents=True, exist_ok=True)
chart_path.write_text(
dedent(
"""
appVersion: 0.1.26
version: 0.1.26
chart_contents = dedent(
"""
appVersion: 0.1.26
version: 0.1.26
"""
)
"""
)
chart1_path = git_repo / "helm" / "charts" / "somechart" / "Chart.yaml"
chart2_path = git_repo / "helm" / "charts" / "otherchart" / "Chart.yaml"
chart1_path.parent.mkdir(parents=True, exist_ok=True)
chart1_path.write_text(chart_contents, encoding="utf-8")
chart2_path.parent.mkdir(parents=True, exist_ok=True)
chart2_path.write_text(chart_contents, encoding="utf-8")

with inside_dir(git_repo):
run_command(["git", "add", str(chart_path), str(config_path)])
run_command(["git", "add", str(chart1_path), str(chart2_path), str(config_path)])
run_command(["git", "commit", "-m", "Initial commit"])

# Act
Expand Down Expand Up @@ -423,11 +424,18 @@ def test_changes_to_files_are_committed(git_repo: Path, caplog):
commit = true
[[tool.bumpversion.files]]
filename = "helm/charts/somechart/Chart.yaml"
glob = "helm/charts/*/Chart.yaml"
"""
)
assert chart1_path.read_text() == dedent(
"""
appVersion: 0.2.0
version: 0.2.0
"""
)
assert chart_path.read_text() == dedent(
assert chart2_path.read_text() == dedent(
"""
appVersion: 0.2.0
version: 0.2.0
Expand Down

0 comments on commit 72f9841

Please sign in to comment.