Skip to content

Commit 18c7394

Browse files
authored
Merge pull request #4 from hypothesis/update-cookiecutter
Updates from cookiecutter
2 parents 5594baa + de2c89b commit 18c7394

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

.cookiecutter/cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"copyright_holder": "Hypothesis",
1313
"public": "yes",
1414
"console_script": "yes",
15-
"__dependabot_interval": "monthly",
15+
"dependabot_npm_interval": "monthly",
1616
"__entry_point": "pip-sync-faster",
1717
"__github_url": "https://github.com/hypothesis/pip-sync-faster",
1818
"__pypi_url": "https://pypi.org/project/pip-sync-faster"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ sure:
7070
.PHONY: template
7171
$(call help,make template,"update from the latest cookiecutter template")
7272
template: python
73-
@pyenv exec tox -e template -- $(cookiecutter)
73+
@pyenv exec tox -e template -- $$(if [ -n "$${template+x}" ]; then echo "--template $$template"; fi) $$(if [ -n "$${checkout+x}" ]; then echo "--checkout $$checkout"; fi) $$(if [ -n "$${directory+x}" ]; then echo "--directory $$directory"; fi)
7474

7575
.PHONY: clean
7676
$(call help,make clean,"delete temporary files etc")

bin/make_template

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
2+
import argparse
23
import json
34
import os
4-
import sys
55
from pathlib import Path
66
from tempfile import TemporaryDirectory
77

@@ -14,10 +14,17 @@ extra_context = config.get("extra_context", {})
1414
extra_context["__ignore__"] = config.get("ignore", [])
1515
extra_context["__target_dir__"] = Path(os.getcwd())
1616

17+
parser = argparse.ArgumentParser(description="Update the project from the cookiecutter template")
18+
parser.add_argument("--template", help="the cookiecutter template to use (default: what's in cookiecutter.json)")
19+
parser.add_argument("--checkout", help="the branch, tag or commit of the cookiecutter template to use (default: what's in cookiecutter.json)")
20+
parser.add_argument("--directory", help="the directory within the cookiecutter repo to use to use (default: what's in cookiecutter.json)")
21+
args = parser.parse_args()
22+
1723
with TemporaryDirectory() as tmpdirname:
1824
cookiecutter(
19-
template=sys.argv[1] if len(sys.argv) >= 2 else config["template"],
20-
directory=config["directory"],
25+
template=args.template or config.get("template"),
26+
checkout=args.checkout or config.get("checkout"),
27+
directory=args.directory or config.get("directory"),
2128
extra_context=extra_context,
2229
no_input=True,
2330
overwrite_if_exists=True,

tests/functional/cli_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from subprocess import run
2+
3+
4+
def test_help():
5+
"""Test the pip-sync-faster --help command."""
6+
run(["pip-sync-faster", "--help"], check=True)
7+
8+
9+
def test_version():
10+
"""Test the pip-sync-faster --version command."""
11+
run(["pip-sync-faster", "--version"], check=True)

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
envlist = tests
33
minversion = 3.25.0
44
requires =
5-
tox-run-command
65
tox-envfile
6+
tox-faster
7+
tox-run-command
78
tox-recreate
89
isolated_build = true
910

0 commit comments

Comments
 (0)