From f35536ccee2cd1e2102bbc0dcf3e39ab49795c4f Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 11 Jun 2015 13:17:04 +0100 Subject: [PATCH] stop InvalidStreamModel from polluting the overall model registry --- wagtail/wagtailcore/tests/test_streamfield.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wagtail/wagtailcore/tests/test_streamfield.py b/wagtail/wagtailcore/tests/test_streamfield.py index 61a1887af..4f77c129f 100644 --- a/wagtail/wagtailcore/tests/test_streamfield.py +++ b/wagtail/wagtailcore/tests/test_streamfield.py @@ -1,5 +1,6 @@ import json +from django.apps import apps from django.test import TestCase from django.db import models @@ -74,6 +75,17 @@ class TestLazyStreamField(TestCase): with self.assertNumQueries(0): instances_lookup[self.no_image.pk].body[0] +class TestSystemCheck(TestCase): + def tearDown(self): + # unregister InvalidStreamModel from the overall model registry + # so that it doesn't break tests elsewhere + for package in ('wagtailcore', 'wagtail.wagtailcore.tests'): + try: + del apps.all_models[package]['invalidstreammodel'] + except KeyError: + pass + apps.clear_cache() + def test_system_check_validates_block(self): class InvalidStreamModel(models.Model): body = StreamField([