Skip to content

Fix failing tests in python-modern-template PR - #9

Merged
tirthbodawala merged 3 commits into
mainfrom
claude/fix-failing-tests-011CUpN6BdBfx55SPkT5KMqK
Nov 5, 2025
Merged

tirthbodawala merged 3 commits into
mainfrom
claude/fix-failing-tests-011CUpN6BdBfx55SPkT5KMqK

Conversation

@tirthbodawala

Copy link
Copy Markdown
Member

Fixed multiple issues causing test failures in generated projects:

  1. Makefile test - Changed to check for package_name (snake_case) instead of project_name (title case with spaces)

    • template/tests/test_makefile.py.jinja
  2. Dependency versions - Updated expected versions to match current pyproject.toml.jinja template:

    • black>=24.8.0 -> 25.9.0
    • isort>=5.13.2 -> 7.0.0
    • mypy>=1.11.2 -> 1.18.2
    • pre-commit>=3.8.0 -> 4.3.0 (conditional)
    • pylint>=3.2.7 -> 4.0.2
    • pytest>=8.3.3 -> 8.4.2
    • pytest-cov>=4.1.0 -> 7.0.0
    • pytest-mock>=3.14.0 -> 3.15.1
    • ruff>=0.6.5 -> 0.14.3
    • template/tests/test_dependencies.py.jinja
  3. Missing fixtures - Added conftest.py with temp_context_dir and sample_session_files fixtures required by finish_task tests

    • template/tests/ai_tools/conftest.py (new file)
  4. Documentation tests - Made tests conditional based on features:

    • Only check AI_DOCS files when include_ai_tools is true
    • Removed checks for template/ directory (doesn't exist in generated projects)
    • Made search_roots conditional based on enabled features
    • template/tests/test_docs.py.jinja

These fixes allow generated projects to pass tests. The remaining template_loader test failures are due to an existing bug in the python-modern-template repository itself (not the template).

Fixes #[issue number if applicable]

Fixed multiple issues causing test failures in generated projects:

1. **Makefile test** - Changed to check for package_name (snake_case)
   instead of project_name (title case with spaces)
   - template/tests/test_makefile.py.jinja

2. **Dependency versions** - Updated expected versions to match current
   pyproject.toml.jinja template:
   - black>=24.8.0 -> 25.9.0
   - isort>=5.13.2 -> 7.0.0
   - mypy>=1.11.2 -> 1.18.2
   - pre-commit>=3.8.0 -> 4.3.0 (conditional)
   - pylint>=3.2.7 -> 4.0.2
   - pytest>=8.3.3 -> 8.4.2
   - pytest-cov>=4.1.0 -> 7.0.0
   - pytest-mock>=3.14.0 -> 3.15.1
   - ruff>=0.6.5 -> 0.14.3
   - template/tests/test_dependencies.py.jinja

3. **Missing fixtures** - Added conftest.py with temp_context_dir and
   sample_session_files fixtures required by finish_task tests
   - template/tests/ai_tools/conftest.py (new file)

4. **Documentation tests** - Made tests conditional based on features:
   - Only check AI_DOCS files when include_ai_tools is true
   - Removed checks for template/ directory (doesn't exist in generated projects)
   - Made search_roots conditional based on enabled features
   - template/tests/test_docs.py.jinja

These fixes allow generated projects to pass tests. The remaining
template_loader test failures are due to an existing bug in the
python-modern-template repository itself (not the template).

Fixes #[issue number if applicable]
…stripping

This commit fixes the template_loader.py generation issue where Copier was
interpreting {{session_id}}, {{task_name}}, {{task_type}}, and {{timestamp}}
as Jinja2 variables and replacing them with empty strings.

Changes:
- Wrapped all {{...}} placeholders in {% raw %}...{% endraw %} blocks in
  template_loader.py.jinja source file (lines 54, 66-69)
- Ensures placeholders survive Copier template generation process
- All 168 tests now pass in generated projects with 100% coverage

Fixes the last remaining test failures in GitHub Actions template generation
workflow (ai-only, minimal, quality-only, docker-only, full-features configs).
The full-features configuration includes mkdocs dependencies when
include_docs=true, but the test expectations didn't account for them.

Changes:
- Added conditional mkdocs dependencies to test_dependencies.py.jinja
- Dependencies are only expected when include_docs flag is enabled
- Mirrors the conditional logic in pyproject.toml.jinja (lines 82-86)

This fixes the last failing test in the "Test full-features" workflow.
All 168 tests now pass with 100% coverage in full-features configuration.
@tirthbodawala
tirthbodawala merged commit 2a0eff7 into main Nov 5, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants