Django Test Parallelization
SkillDev toolsSafely parallelize Django and pytest-django test suites with Django --parallel, pytest-xdist, test isolation checks, randomized order detection, shared-resource sharding, locks, and load balancing. Use when enabling parallel tests, diagnosing failures under parallel execution, handling flaky Django tests, or making caches, files, queues, and external resources safe across workers.
Use Django Test Parallelization in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Django Test Parallelization and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Django Test Parallelization skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by hashgraph-online/awesome-codex-plugins in plugins/LVTD-LLC/skills/skills/django-test-parallelization/SKILL.md and read by Ahel’s review.
Parallel test execution is a multiplier after a suite is isolated. Treat failures under parallel execution as evidence of hidden shared state until proven otherwise.
Readiness Workflow
-
Measure serial runtime first.
- If the suite is already dominated by startup or database creation, parallelism may not help enough on its own.
-
Check isolation before enabling parallelism as the default.
- Run in reverse order.
- Run with randomized order when reverse order is not enough.
- Preserve random seeds so failures can be reproduced.
-
Enable the runner deliberately.
- Django runner: install
tblib, then runpython manage.py test --parallel. - pytest-django: install
pytest-xdist, then runpytest -n auto.
- Django runner: install
-
Classify failures.
- Order-dependent failures usually come from mutated globals, class attributes, settings, caches, monkeypatches, or database assumptions.
- Parallel-only failures usually come from shared resources such as files, cache keys, ports, queues, external services, or temporary directories.
-
Make resources worker-safe.
- Prefer sharding per process or worker.
- Use locks only when the resource cannot be partitioned.
- Keep lock scope narrow.
-
Balance work after it is correct.
- Split large test classes or modules only when measurement shows one group holds back the parallel run.
Commands
python -m pip install tblib
python manage.py test --parallel
python manage.py test --parallel 1
python manage.py test --reverse
python -m pip install pytest-xdist
pytest -n auto
pytest -n auto --dist loadscope
For shared-resource patterns, read shared-resources.md.
Decision Rules
- Add parallel testing early in new projects; older serial suites often have hidden isolation assumptions.
- Use CI reverse-order testing as a low-friction guard against order dependencies.
- Use random order when reverse order misses a suspected dependency, and capture the seed.
- Prefer
pytest -n auto --dist loadscopefor DjangoTestCase-heavy suites because class/module setup can be expensive. - Shard resources before reaching for locks.
- Put process-specific behavior in test settings only, not production settings.
- Split large test groups only after profiling shows an imbalance.
Common Mistakes
- Assuming database transaction isolation protects caches, files, task queues, or external systems.
- Mutating class attributes, globals, app settings, or cache entries without restoring them.
- Enabling random order without preserving the seed.
- Using a single lockfile for too much work and accidentally serializing the suite.
- Letting pytest-xdist split related tests so finely that setup cost is duplicated.
- Making parallelism the default before the suite passes reliably under order-isolation checks.
Verification
Before calling parallelization complete:
- Serial run passes.
- Reverse or random-order run passes, or known failures are fixed.
- Parallel run passes at least twice.
- Any shared-resource sharding lives in test configuration.
- CI has a serial fallback command for debugging.
Signals
- GitHub stars
- 1k
- Forks
- 316
- Last commit
- Oct 2026
Ahel review
K1binfo
installs-packages
Automated review, not a security audit. Ruleset v1+k2.
Advanced
- Item type
- skill
- Key
django-test-parallelization- Source
- github.com/hashgraph-online/awesome-codex-plugins
github.com/hashgraph-online/awesome-codex-plugins
Related picks
Skill · wshobson
The pick for Pythonpython-pro
Skill · jeffallan
The pick for Pythondjango-targeted-mocking
Skill · hashgraph-online
The pick for Djangointegration-django
Skill · posthog
The pick for Djangoteach
Skill · mattpocock
More in Dev toolsimplement
Skill · mattpocock
More in Dev tools