Fix failing tests in python-modern-template PR - #9
Merged
tirthbodawala merged 3 commits intoNov 5, 2025
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed multiple issues causing test failures in generated projects:
Makefile test - Changed to check for package_name (snake_case) instead of project_name (title case with spaces)
Dependency versions - Updated expected versions to match current pyproject.toml.jinja template:
Missing fixtures - Added conftest.py with temp_context_dir and sample_session_files fixtures required by finish_task tests
Documentation tests - Made tests conditional based on features:
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]