You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Special branches: `master`, `main`, `develop`, `staging`, `production`
90
95
91
-
2.**Custom commands** - Runs commands defined in `.dev-hooks.yml` (tests, build, etc.)
96
+
3.**Django Smart Tests** - Runs tests only for modified apps/modules (configurable)
97
+
98
+
4.**Custom commands** - Runs commands defined in `.dev-hooks.yml` (tests, build, etc.)
92
99
93
100
## Configuration File
94
101
@@ -147,6 +154,45 @@ If no matching files are found, commands are skipped with a message:
147
154
Skipping pre-push commands (no matching files: *.py)
148
155
```
149
156
157
+
### Django Smart Tests
158
+
159
+
For Django/Python projects, enable smart test features:
160
+
161
+
```yaml
162
+
pre-commit:
163
+
# Warn about modified files without tests (default: true)
164
+
django_check_tests: true
165
+
166
+
pre-push:
167
+
# Run tests only for modified apps (default: true)
168
+
django_smart_tests: true
169
+
# Test command (default: "pytest")
170
+
django_test_command: "pytest"
171
+
```
172
+
173
+
**How it works:**
174
+
175
+
1. **pre-commit**: Analyzes staged Python files and warns if they don't have corresponding test files (e.g., `test_<filename>.py`). This is just a warning and won't block the commit.
176
+
177
+
2. **pre-push**: Detects which Django apps/modules were modified and runs tests only for those apps instead of the entire test suite:
0 commit comments