Skip to content

Commit cab7109

Browse files
committed
Fix example updating test
If we tag an existing commit that has been pushed to main, then the copier update on the old commit id will be generated with the new tag name, which means the link will not be updated. As this only affects the example repo which is the only thing that points to main then we ignore it
1 parent 966f726 commit cab7109

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_example.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ def test_example_repo_updates(tmp_path: Path):
8383
run("git commit -am 'Update src'")
8484
run(f"copier update --trust --vcs-ref=HEAD --data-file {TOP}/example-answers.yml")
8585
output = run(
86-
"diff -ur --exclude=.git --ignore-matching-lines='_commit: '"
87-
f" {generated_path} {example_path}"
86+
# Git directory expected to be different
87+
"diff -ur --exclude=.git "
88+
# The commit hash is different for some reason
89+
"--ignore-matching-lines='^_commit: ' "
90+
# If we tag an existing commit that has been pushed to main, then the copier
91+
# update on the old commit id will be generated with the new tag name, which
92+
# means the link will not be updated. As this only affects the example repo
93+
# which is the only thing that points to main then we ignore it
94+
"--ignore-matching-lines='^For more information on common tasks like setting' "
95+
f"{generated_path} {example_path}"
8896
)
8997
assert not output, output

0 commit comments

Comments
 (0)