Safely 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.
Safely 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.
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Claude CodeDeclared
CursorNot declared
CodexDeclared
GitHub CopilotNot declared
WindsurfNot declared
Gemini CLINot declared
ClineNot declared
OpenCodeNot declared
Repository health
Stars1
LicenseLICENSE
Default branchmain
Open issues0
Status
Active
Skill metadata
Parsed from SKILL.md frontmatter.
Version0.1.0
LicenseMIT
CompatibilityCodex, Claude Code, and other Agent Skills-compatible clients.
Declared agentsclaude-codecodex
More metadata
version
0.1.0
displayName
Django Test Parallelization
category
Django
tags
django,testing,parallelization,pytest,xdist
Package contents
Files included with this skill beyond the listing page.
skill mdSKILL.md3,844 B
docsSUMMARY.md418 B
History
First seen on skills.sh
First recorded snapshot · 57 installs
SKILL.md
Django Test Parallelization
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 run python manage.py test --parallel. - pytest-django: install pytest-xdist, then run pytest -n auto.
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](references/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 loadscope for Django TestCase-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.