Skip to content

Commit

Permalink
Add docstring to unregistered_django_model
Browse files Browse the repository at this point in the history
  • Loading branch information
millerdev committed Mar 25, 2022
1 parent b4f0b6b commit 45465a5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions corehq/util/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ def get_output(self):


def unregistered_django_model(model_class):
"""Model class decorator that unregisters the model from Django
Apply to model classes in test modules to prevent the models from
being seen by other tests that check registered models. Examples
of tests that check registered models include
- corehq.apps.domain.tests.test_deletion_models:test_deletion_sql_models
- corehq.sql_db.tests.test_model_partitioning
:TestPartitionedModelsWithMultipleDBs
.test_models_are_located_in_correct_dbs('scheduling', False)
"""
app_config = apps.get_app_config(model_class._meta.app_label)
del app_config.models[model_class.__name__.lower()]
return model_class
Expand Down

0 comments on commit 45465a5

Please sign in to comment.