Browse Source

[UPD] Latest cruft

master
Justin Lecher 3 months ago
parent
commit
6e02b7dead
  1. 5
      .cruft.json
  2. 6
      hooks/pre_gen_project.py
  3. 4
      tests/test_all.py

5
.cruft.json

@ -1,6 +1,6 @@
{
"template": "git@git.ercpe.de:justin/cookiecutter-cookie.git",
"commit": "f0580cea84d52371582980b2bd3a46089009aadb",
"commit": "444986e99a37ddd4cd225f62af13b2c8ffde14d4",
"context": {
"cookiecutter": {
"full_name": "Justin Lecher",
@ -11,5 +11,6 @@
"_template": "git@git.ercpe.de:justin/cookiecutter-cookie.git"
}
},
"directory": null
"directory": null,
"checkout": null
}

6
hooks/pre_gen_project.py

@ -5,10 +5,10 @@ import sys
ROLE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"
ANSIBLE_ROLE = "{{ cookiecutter.role_name }}"
TEST_VAR = "{{ cookiecutter.role_name }}"
if not re.match(ROLE_REGEX, ANSIBLE_ROLE):
print(f"ERROR: '{ANSIBLE_ROLE}' is not a valid Python module name!")
if not re.match(ROLE_REGEX, TEST_VAR):
print(f"ERROR: '{TEST_VAR}' is not a valid Python module name!")
# exits with status 1 to indicate failure
sys.exit(1)

tests/test_bake_project.py → tests/test_all.py

@ -24,6 +24,8 @@ DIRS = (
"vars",
)
TEST_VAR = "role_name"
@contextmanager
def inside_dir(dirpath):
@ -114,7 +116,7 @@ def test_make_help(cookies):
def test_bake_invalid_name(cookies):
bake_in_temp_dir(cookies, extra_context={"role_name": "foo-bar"})
bake_in_temp_dir(cookies, extra_context={TEST_VAR: "foo-bar"})
def test_bake(cookies):
Loading…
Cancel
Save