Skip to content

Commit

Permalink
Rename template info key names in cookiecutter context
Browse files Browse the repository at this point in the history
- In cookiecutter>=2.2.0, the template key in context has special
  meaning for nested templates and must be renamed.
  • Loading branch information
rmartin16 committed Jul 7, 2023
1 parent 73148bf commit 982171a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions changes/1347.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An error no longer occurs when creating a new Briefcase project while ``cookiecutter>=2.2.0`` is installed.
4 changes: 2 additions & 2 deletions src/briefcase/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ def new_app(
# include the version of Briefcase as well as the source of the template.
context.update(
{
"template": template,
"branch": branch,
"template_source": template,
"template_branch": branch,
"briefcase_version": briefcase.__version__,
}
)
Expand Down
32 changes: 16 additions & 16 deletions tests/commands/new/test_new_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def test_new_app(
# The expected app context
# should now also contain the
# default template and branch
"template": "https://github.com/beeware/briefcase-template",
"branch": expected_branch,
"template_source": "https://github.com/beeware/briefcase-template",
"template_branch": expected_branch,
"briefcase_version": briefcase_version,
},
)
Expand Down Expand Up @@ -129,8 +129,8 @@ def test_new_app_missing_template(monkeypatch, new_command, tmp_path):
# The expected app context
# should now also contain the
# default template and branch
"template": "https://github.com/beeware/briefcase-template",
"branch": "v37.42.7",
"template_source": "https://github.com/beeware/briefcase-template",
"template_branch": "v37.42.7",
"briefcase_version": "37.42.7",
},
)
Expand Down Expand Up @@ -196,8 +196,8 @@ def test_new_app_dev(monkeypatch, new_command, tmp_path, briefcase_version):
# The expected app context
# should now also contain the
# default template and branch
"template": "https://github.com/beeware/briefcase-template",
"branch": "v37.42.7",
"template_source": "https://github.com/beeware/briefcase-template",
"template_branch": "v37.42.7",
"briefcase_version": briefcase_version,
},
),
Expand All @@ -213,8 +213,8 @@ def test_new_app_dev(monkeypatch, new_command, tmp_path, briefcase_version):
# The expected app context
# should now also contain the
# default template and branch
"template": "https://github.com/beeware/briefcase-template",
"branch": "v37.42.7",
"template_source": "https://github.com/beeware/briefcase-template",
"template_branch": "v37.42.7",
"briefcase_version": briefcase_version,
},
),
Expand Down Expand Up @@ -261,8 +261,8 @@ def test_new_app_with_template(monkeypatch, new_command, tmp_path):
# The expected app context
# should now also contain the
# template and branch
"template": "https://example.com/other.git",
"branch": "v37.42.7",
"template_source": "https://example.com/other.git",
"template_branch": "v37.42.7",
"briefcase_version": "37.42.7",
},
)
Expand Down Expand Up @@ -313,8 +313,8 @@ def test_new_app_with_invalid_template(monkeypatch, new_command, tmp_path):
# The expected app context
# should now also contain the
# template and branch
"template": "https://example.com/other.git",
"branch": "v37.42.7",
"template_source": "https://example.com/other.git",
"template_branch": "v37.42.7",
"briefcase_version": "37.42.7",
},
)
Expand Down Expand Up @@ -368,8 +368,8 @@ def test_new_app_with_invalid_template_branch(monkeypatch, new_command, tmp_path
# The expected app context
# should now also contain the
# template and branch
"template": "https://example.com/other.git",
"branch": "v37.42.7",
"template_source": "https://example.com/other.git",
"template_branch": "v37.42.7",
"briefcase_version": "37.42.7",
},
)
Expand Down Expand Up @@ -414,8 +414,8 @@ def test_new_app_with_branch(monkeypatch, new_command, tmp_path):
# The expected app context
# should now also contain the
# template and branch
"template": "https://github.com/beeware/briefcase-template",
"branch": "experimental",
"template_source": "https://github.com/beeware/briefcase-template",
"template_branch": "experimental",
"briefcase_version": "37.42.7",
},
)
Expand Down

0 comments on commit 982171a

Please sign in to comment.