Registry / testing / django-consistency-enforcer

django-consistency-enforcer

JSON →
library0.5.1pypypiunverified

A Django library that provides testing utilities to enforce internal consistency across Django concepts (models, signals, permissions, etc.). Current version is 0.5.1, with monthly releases.

pip install django-consistency-enforcer
INSTALL
IMPORT
SIG · DJANGO-CONSISTENCY
D
django-consistency-enforcer
testingpythonv0.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ConsistencyEnforcer
from django_consistency_enforcer import ConsistencyEnforcer
from consistency_enforcer import ConsistencyEnforcer

Basic usage of ConsistencyEnforcer to verify internal consistency in Django tests.

# In your test file from django.test import TestCase from consistency_enforcer import ConsistencyEnforcer class MyModelTest(TestCase): def test_model_consistency(self): enforcer = ConsistencyEnforcer() # This will check that all model references are consistent enforcer.check_all()
Debug
Known issues
breakingIn version 0.5.0, the import path for `ConsistencyEnforcer` changed from `consistency_enforcer.enforcer` to `consistency_enforcer`. Old imports will break.
fix
Update imports to `from consistency_enforcer import ConsistencyEnforcer`.
affects: >=0.5.0
deprecatedThe `enforce_consistency` decorator is deprecated in favor of using the `ConsistencyEnforcer` class directly. It will be removed in version 0.6.
fix
Replace `@enforce_consistency` with a call to `enforcer.check_all()` inside the test.
affects: >=0.5.0
gotchaThe enforcer may be slow on large projects because it inspects all Django apps' models and signals. Run it only on specific apps or models in CI to avoid timeout.
fix
Pass app labels to `check_all(app_labels=['myapp'])` to limit scope.
affects: all
Upgrade
Version history
0.5.1latest on PyPI · released Apr 9, 2026
Audit
Dependencies
djangorequiredRuntime dependency; enforcer works with Django models and ORM.
Agent activity
4 hits · last 30 days
node
4
Resources
django-consistency-enforcer — pip install django-consistency-enforcer · libregistry