From 45465a529b49d28db430bc539fd45850af502541 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Fri, 25 Mar 2022 07:27:03 -0400 Subject: [PATCH] Add docstring to unregistered_django_model --- corehq/util/test_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/corehq/util/test_utils.py b/corehq/util/test_utils.py index cb2c2f4b26ee..8e30a44790ed 100644 --- a/corehq/util/test_utils.py +++ b/corehq/util/test_utils.py @@ -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