mirror of
https://github.com/copier-org/copier.git
synced 2025-05-28 10:31:21 +00:00
Due to copier not reloading the `copier.yml` file when doing the previous step to diff updates, it was trying to run tasks from let's say `v2` of the template after copying its `v1` version. After this change, when copying `v1`, its `copier.yml` is reloaded, loading tasks for that version only (and executing them as usual). The patch includes a git bundle that is a git repo with a couple of commits required to replicate the bug. @Tecnativa TT20357
31 lines
874 B
Python
31 lines
874 B
Python
from pathlib import Path
|
|
|
|
from plumbum import local
|
|
from plumbum.cmd import git
|
|
|
|
from copier import copy
|
|
|
|
from .helpers import PROJECT_TEMPLATE
|
|
|
|
REPO_BUNDLE_PATH = Path(f"{PROJECT_TEMPLATE}_update_tasks.bundle").absolute()
|
|
|
|
|
|
def test_update_tasks(tmpdir):
|
|
"""Test that updating a template runs tasks from the expected version."""
|
|
dst = tmpdir / "dst"
|
|
# Copy the 1st version
|
|
copy(
|
|
str(REPO_BUNDLE_PATH), dst, force=True, vcs_ref="v1",
|
|
)
|
|
# Init destination as a new independent git repo
|
|
with local.cwd(dst):
|
|
git("init")
|
|
# Configure git in case you're running in CI
|
|
git("config", "user.name", "Copier Test")
|
|
git("config", "user.email", "test@copier")
|
|
# Commit changes
|
|
git("add", ".")
|
|
git("commit", "-m", "hello world")
|
|
# Update target to v2
|
|
copy(dst_path=str(dst), force=True)
|