|
| 1 | +--- |
| 2 | +description: "Comprehensive testing of the cookiecutter template across all configurations." |
| 3 | +--- |
| 4 | + |
| 5 | +# Template Testing Prompt |
| 6 | + |
| 7 | +Please perform comprehensive testing of the cookiecutter template to ensure all configurations generate working projects with passing tests, type checking, and linting. |
| 8 | + |
| 9 | +## Task Requirements: |
| 10 | + |
| 11 | +### 1. Standard Test Configurations |
| 12 | + |
| 13 | +Test ALL three standard configurations located in the `tests/` directory: |
| 14 | + |
| 15 | +- **Full configuration** (`tests/full.yaml`): All features enabled (FastAPI, Celery, QuasiQueue, Database, Caching, Docker) |
| 16 | +- **Library configuration** (`tests/library.yaml`): Minimal setup for Python library development |
| 17 | +- **Bare configuration** (`tests/bare.yaml`): Basic project with no optional features |
| 18 | + |
| 19 | +### 2. Testing Workflow |
| 20 | + |
| 21 | +For EACH configuration, perform these steps: |
| 22 | + |
| 23 | +#### Step 1: Generate Project |
| 24 | + |
| 25 | +```bash |
| 26 | +cd /Users/tedivm/Repositories/tedivm/robs_awesome_python_template |
| 27 | +rm -rf workspaces/<config_name> |
| 28 | +cookiecutter --config-file tests/<config_name>.yaml --no-input --output-dir workspaces . |
| 29 | +cd workspaces/<config_name> |
| 30 | +``` |
| 31 | + |
| 32 | +#### Step 2: Run Test Suite |
| 33 | + |
| 34 | +Run the key validation checks: |
| 35 | + |
| 36 | +```bash |
| 37 | +make pytest # Run all tests with coverage |
| 38 | +make mypy_check # Type checking |
| 39 | +make ruff_check # Linting |
| 40 | +``` |
| 41 | + |
| 42 | +Note: Formatting issues (dapperdata, tomlsort, paracelsus) can be auto-fixed with `make chores` and are not critical for validation. |
| 43 | + |
| 44 | +#### Step 3: Verify Results |
| 45 | + |
| 46 | +Check that: |
| 47 | + |
| 48 | +- ✅ All tests pass (exit code 0) |
| 49 | +- ✅ Test coverage meets expectations (typically 90%+ for full/library, 100% for bare) |
| 50 | +- ✅ No mypy type errors |
| 51 | +- ✅ No ruff linting errors |
| 52 | +- ✅ Code formatting is correct |
| 53 | + |
| 54 | +### 3. Context-Specific Testing |
| 55 | + |
| 56 | +**IMPORTANT:** In addition to the three standard configurations, create and test additional custom configurations relevant to your current work session. |
| 57 | + |
| 58 | +For example: |
| 59 | + |
| 60 | +- If you modified caching functionality, test a config with caching enabled and one with it disabled |
| 61 | +- If you updated Docker configurations, test with and without Docker components |
| 62 | +- If you modified CLI functionality, test with and without optional CLI features |
| 63 | +- If you modify a component with hooks into a lot of other systems, create multiple configurations to validate those changes |
| 64 | + |
| 65 | +#### Creating Custom Test Configurations |
| 66 | + |
| 67 | +Create temporary YAML config files in the `workspaces/` directory (these won't be committed): |
| 68 | + |
| 69 | +```yaml |
| 70 | +# Example: workspaces/custom_test.yaml |
| 71 | +default_context: |
| 72 | + project_name: "Custom Test" |
| 73 | + project_slug: "custom_test" |
| 74 | + package_name: "custom_test" |
| 75 | + include_fastapi: "y" |
| 76 | + include_celery: "n" |
| 77 | + include_database: "y" |
| 78 | + include_caching: "y" |
| 79 | + # ... other settings as needed |
| 80 | +``` |
| 81 | + |
| 82 | +Then test with: |
| 83 | + |
| 84 | +```bash |
| 85 | +cookiecutter --config-file workspaces/custom_test.yaml --no-input --output-dir workspaces . |
| 86 | +``` |
| 87 | + |
| 88 | +### 4. Expected Test Results |
| 89 | + |
| 90 | +Standard configurations should produce these results: |
| 91 | + |
| 92 | +#### Bare Configuration |
| 93 | + |
| 94 | +- **Tests**: ~11 tests |
| 95 | +- **Coverage**: 100% |
| 96 | +- **Files tested**: Core settings and configuration |
| 97 | + |
| 98 | +#### Library Configuration |
| 99 | + |
| 100 | +- **Tests**: ~26 tests |
| 101 | +- **Coverage**: ~93% |
| 102 | +- **Files tested**: CLI, settings, basic project structure |
| 103 | +- **Note**: CLI should have version and hello commands |
| 104 | + |
| 105 | +#### Full Configuration |
| 106 | + |
| 107 | +- **Tests**: ~147 tests |
| 108 | +- **Coverage**: ~94% |
| 109 | +- **Files tested**: All services (cache, db, jinja), celery, CLI, QuasiQueue, FastAPI, settings |
| 110 | +- **Note**: Most comprehensive test suite with all features |
| 111 | + |
| 112 | +### 5. Common Issues and Troubleshooting |
| 113 | + |
| 114 | +#### Issue: Jinja2 Template Errors |
| 115 | + |
| 116 | +- **Cause**: Raw Jinja2 code in documentation or examples |
| 117 | +- **Solution**: Ensure all Jinja2 examples in markdown files are wrapped in `{% raw %}...{% endraw %}` |
| 118 | + |
| 119 | +#### Issue: Mypy Type Errors |
| 120 | + |
| 121 | +- **Cause**: Missing type annotations or untyped library imports |
| 122 | +- **Solution**: Check pyproject.toml has strict mypy settings enabled; use `# type: ignore` for untyped third-party libraries as a last resort only |
| 123 | + |
| 124 | +#### Issue: CLI Tests Failing |
| 125 | + |
| 126 | +- **Cause**: Typer single-command behavior or missing commands |
| 127 | +- **Solution**: Ensure CLI always has at least 2 commands (version + hello minimum) |
| 128 | + |
| 129 | +#### Issue: Import Errors |
| 130 | + |
| 131 | +- **Cause**: Optional dependencies not properly handled |
| 132 | +- **Solution**: Check that conditional imports use try/except blocks or are properly guarded |
| 133 | + |
| 134 | +### 6. Reporting Results |
| 135 | + |
| 136 | +After testing, provide a summary that includes: |
| 137 | + |
| 138 | +1. **Configuration Results**: For each tested configuration |
| 139 | + |
| 140 | + - Configuration name |
| 141 | + - Number of tests run |
| 142 | + - Number of tests passed/failed |
| 143 | + - Code coverage percentage |
| 144 | + - Any errors or warnings |
| 145 | + |
| 146 | +2. **Test Output Analysis**: Key findings from test execution |
| 147 | + |
| 148 | + - Any deprecation warnings |
| 149 | + - Performance issues |
| 150 | + - Coverage gaps in important modules |
| 151 | + |
| 152 | +3. **Validation Status**: Overall health check |
| 153 | + - ✅ All standard configurations passing |
| 154 | + - ✅ Context-specific configurations passing |
| 155 | + - ✅ Type checking clean (mypy) |
| 156 | + - ✅ Linting clean (ruff) |
| 157 | + - ✅ Formatting correct (black) |
| 158 | + |
| 159 | +### 7. Performance Considerations |
| 160 | + |
| 161 | +- Run tests in sequence, not parallel (to avoid resource conflicts) |
| 162 | +- Clean up workspace directories between runs to ensure fresh state |
| 163 | +- Virtual environments can be reused within a configuration but should be recreated between different configurations |
| 164 | + |
| 165 | +### 8. Template Context Awareness |
| 166 | + |
| 167 | +Remember that this is a **cookiecutter template project**, which means: |
| 168 | + |
| 169 | +- The actual template files are in `{{cookiecutter.__package_slug}}/` |
| 170 | +- Test configurations are in `tests/*.yaml` |
| 171 | +- Generated projects appear in `workspaces/` |
| 172 | +- Many files contain Jinja2 templating syntax that looks like broken Python/YAML |
| 173 | +- The `hooks/post_gen_project.py` script removes unnecessary files based on configuration |
| 174 | + |
| 175 | +### 9. Success Criteria |
| 176 | + |
| 177 | +Testing is considered successful when: |
| 178 | + |
| 179 | +- ✅ All three standard configurations generate working projects |
| 180 | +- ✅ All test suites pass with high coverage (90%+) |
| 181 | +- ✅ No type checking errors (mypy clean) |
| 182 | +- ✅ No linting errors (ruff clean) |
| 183 | +- ✅ All formatting is correct (black clean) |
| 184 | +- ✅ Any context-specific configurations relevant to recent changes also pass |
| 185 | +- ✅ Exit codes are 0 for all test runs |
| 186 | +- ✅ No warnings or errors in test output |
| 187 | + |
| 188 | +## Implementation Approach: |
| 189 | + |
| 190 | +1. **Prepare**: Understand what changes were made in the current session |
| 191 | +2. **Plan**: Identify which configurations are most relevant to test |
| 192 | +3. **Execute**: Run standard configurations (bare, library, full) sequentially |
| 193 | +4. **Validate**: Create and test custom configurations for specific scenarios |
| 194 | +5. **Report**: Provide clear summary of all test results |
| 195 | +6. **Iterate**: If any tests fail, investigate and fix before proceeding |
| 196 | + |
| 197 | +Remember: Testing is not just about running commands—it's about validating that the template produces high-quality, production-ready Python projects across all supported configurations. |
0 commit comments