From f540ee61602e34deb86492021e2dfc51d050ec49 Mon Sep 17 00:00:00 2001 From: Guillaume Tauzin <4648633+gtauzin@users.noreply.github.com> Date: Thu, 26 Mar 2026 17:45:39 +0100 Subject: [PATCH] feat(template): backport worktrees gitignore and compat job fix Signed-off-by: Guillaume Tauzin <4648633+gtauzin@users.noreply.github.com> --- .../tests.yml.jinja | 4 +++- template/.gitignore.jinja | 3 +++ tests/test_github_workflows.py | 11 +++++++++++ tests/test_template.py | 10 ++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/template/.github/{% if include_actions %}workflows{% endif %}/tests.yml.jinja b/template/.github/{% if include_actions %}workflows{% endif %}/tests.yml.jinja index d1fb9f5..1caa440 100644 --- a/template/.github/{% if include_actions %}workflows{% endif %}/tests.yml.jinja +++ b/template/.github/{% if include_actions %}workflows{% endif %}/tests.yml.jinja @@ -52,13 +52,15 @@ jobs: run: nox -s test_fast --python {% raw %}${{ matrix.python-version }}{% endraw %} # Compatibility test against oldest supported dependency versions + # Uncomment pins when compat pin files are added (e.g., "oldest", "legacy") test-compat: + if: false # disabled until pins are defined name: {% raw %}Compat tests (${{ matrix.pins }}){% endraw %} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - pins: [] + pins: ["placeholder"] steps: - name: Checkout code diff --git a/template/.gitignore.jinja b/template/.gitignore.jinja index 7babafd..8363767 100644 --- a/template/.gitignore.jinja +++ b/template/.gitignore.jinja @@ -87,6 +87,9 @@ docs/examples/*/ {% endif %}# Auto-generated API submodule pages (created by docs/hooks.py) docs/pages/api/ +# Worktrees +.worktrees/ + # AI Assistant Instructions CLAUDE.md CLAUDE_INSTRUCTIONS.md diff --git a/tests/test_github_workflows.py b/tests/test_github_workflows.py index 1921413..73c320f 100644 --- a/tests/test_github_workflows.py +++ b/tests/test_github_workflows.py @@ -125,6 +125,17 @@ def test_tests_workflow_excludes_examples_when_disabled(self, copie): # Should NOT have examples-related content assert "test_examples" not in workflow_content and "run-examples" not in workflow_content + def test_tests_workflow_compat_job_disabled(self, copie): + """Test that test-compat job is disabled until pins are defined.""" + result = copie.copy(extra_answers={"include_actions": True}) + assert result.exit_code == 0 + + workflow_path = result.project_dir / ".github" / "workflows" / "tests.yml" + workflow_content = workflow_path.read_text(encoding="utf-8") + + assert "if: false # disabled until pins are defined" in workflow_content + assert 'pins: ["placeholder"]' in workflow_content + class TestPublishWorkflow: """Test the publish-release.yml workflow.""" diff --git a/tests/test_template.py b/tests/test_template.py index 0a08cd5..1ec4290 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -77,6 +77,16 @@ def test_gitignore_excludes_examples_when_disabled(copie): assert "docs/examples/*/" not in content +def test_gitignore_includes_worktrees(copie_session_default): + """Test that .gitignore includes .worktrees/ entry.""" + result = copie_session_default + + content = (result.project_dir / ".gitignore").read_text(encoding="utf-8") + + assert "# Worktrees" in content + assert ".worktrees/" in content + + def test_gitignore_uses_project_name_for_version_file(copie): """Test that .gitignore uses project_name variable (not project_slug) for the version file path.""" result = copie.copy(extra_answers={"package_name": "my_package", "project_slug": "my-project"})