Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed May 17, 2024
1 parent bd30e5a commit fe55985
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backend_addon/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""Post generation hook."""

from copy import deepcopy
from collections import OrderedDict
from copy import deepcopy
from pathlib import Path

from cookieplone.utils import console, files, git


context: OrderedDict = {{cookiecutter}}


Expand All @@ -17,6 +16,7 @@
]
}


def handle_feature_headless(context: OrderedDict, output_dir: Path):
package_namespace = context.get("__package_namespace")
package_name = context.get("__package_name")
Expand Down
1 change: 1 addition & 0 deletions backend_addon/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def context_no_headless(context) -> dict:
new_context["feature_headless"] = "0"
return new_context


@pytest.fixture(scope="session")
def context_no_git(context) -> dict:
"""Cookiecutter context without Git repository."""
Expand Down
3 changes: 2 additions & 1 deletion backend_addon/tests/test_cutter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Test cookiecutter generation with all features enabled."""

from pathlib import Path

import pytest

from pathlib import Path
from .conftest import PKG_SRC_FEATURE_HEADLESS, PKG_SRC_FILES, ROOT_FILES


Expand Down
9 changes: 7 additions & 2 deletions project/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def main():
"""Final fixes."""
output_dir = Path().cwd()

initialize_git = bool(int(context.get("__project_git_initialize")))
# Cleanup / Git
actions = [
[
Expand All @@ -109,8 +110,8 @@ def main():
],
[
handle_git_initialization,
"Remove GHA deployment files",
bool(int(context.get("__project_git_initialize"))),
"Initialize Git repository",
initialize_git,
],
]
for func, title, enabled in actions:
Expand All @@ -135,6 +136,10 @@ def main():
console.print(f" -> {title}")
func(new_context, output_dir)

# Do a second run add newly created files
if initialize_git:
handle_git_initialization(context, output_dir)

msg = """
[bold blue]{{ cookiecutter.title }}[/bold blue]
Expand Down

0 comments on commit fe55985

Please sign in to comment.