(self)
| 144 | self.isolated_local_models = [] |
| 145 | |
| 146 | def tearDown(self): |
| 147 | # Delete any tables made for our models |
| 148 | self.delete_tables() |
| 149 | new_apps.clear_cache() |
| 150 | for model in new_apps.get_models(): |
| 151 | model._meta._expire_cache() |
| 152 | if "schema" in new_apps.all_models: |
| 153 | for model in self.local_models: |
| 154 | for many_to_many in model._meta.many_to_many: |
| 155 | through = many_to_many.remote_field.through |
| 156 | if through and through._meta.auto_created: |
| 157 | del new_apps.all_models["schema"][through._meta.model_name] |
| 158 | del new_apps.all_models["schema"][model._meta.model_name] |
| 159 | if self.isolated_local_models: |
| 160 | with connection.schema_editor() as editor: |
| 161 | for model in self.isolated_local_models: |
| 162 | editor.delete_model(model) |
| 163 | |
| 164 | def delete_tables(self): |
| 165 | "Deletes all model tables for our models for a clean test environment" |
nothing calls this directly
no test coverage detected