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
94
91
-
2.**Custom commands** - Runs commands defined in `.dev-hooks.yml` (tests, build, etc.)
95
+
3.**Django Smart Tests** - Runs tests only for modified apps/modules (configurable)
96
+
97
+
4.**Custom commands** - Runs commands defined in `.dev-hooks.yml` (tests, build, etc.)
92
98
93
99
## Configuration File
94
100
@@ -147,6 +153,45 @@ If no matching files are found, commands are skipped with a message:
147
153
Skipping pre-push commands (no matching files: *.py)
148
154
```
149
155
156
+
### Django Smart Tests
157
+
158
+
For Django/Python projects, enable smart test features:
159
+
160
+
```yaml
161
+
pre-commit:
162
+
# Warn about modified files without tests (default: true)
163
+
django_check_tests: true
164
+
165
+
pre-push:
166
+
# Run tests only for modified apps (default: true)
167
+
django_smart_tests: true
168
+
# Test command (default: "pytest")
169
+
django_test_command: "pytest"
170
+
```
171
+
172
+
**How it works:**
173
+
174
+
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.
175
+
176
+
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